#include<stdio.h>
int main()
{
    int n, temp, digits = 0;
    scanf("%d", &n);
    if(n < 0){
        printf("Invalid input");
        return 0;
    }
    temp = n;
    int t = n;
    while(t > 0) {
        digits++;
        t /= 10;
    }
    int sum = 0;
    t = n;
    while(t > 0) {
        int digit = t % 10;
        sum += pow(digit ,digits);
        t /= 10;
    }
    if (sum == n)
    printf("Armstrong");
    else
    printf("Not Armstrong");
    return 0;
}