import java.util.*;
public class ArmStrongNo {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter starting number number");
int start = sc.nextInt();
System.out.println("Enter ending number");
int end = sc.nextInt();
for (int i = start; i <= end; i++) {
if (isArmStrong(i)) {
System.out.print(i);
}
}
}
public static boolean isArmStrong(int n) {
int temp;
int digit = 0;
int sum = 0;
int last = 0;
temp = n;
while (temp > 0) {
temp = temp / 10;
digit += 1;
}
temp = n;
while (temp > 0) {
last = temp % 10;
sum += Math.pow(last, digit);
temp = temp / 10;
}
if (n == sum) {
return true;
} else {
return false;
}
}
}