#include<stdio.h>
#include<math.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 suum = 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;
}