/*
int n,m;
string c;
stringstream s1,s2;
for(int i=1; i<=1000000; i++){
int sum = 0;
s1.str("");
s1.clear();
s1 << i;
s1 >> c;
n = c.size();
for(int j=0; j<n; j++){
s2.str("");
s2.clear();
s2 << c[j];
s2 >> m;
sum += pow(m, n);
}
if(i==sum)cout << i << " ";
}
*/
int ary[]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834};