#include<stdio.h>
#include<math.h>
int main() 
{
    int n;
    scanf("%d",&n);
    if(n < 0)
    {
        printf("Invalid Input");
    }
    else
    {
        int originalnum = n;
        int numdigits = 0;
        int temp = n;
        if(temp == 0)
        {
            numdigits = 1;
        }
        else
        {
            while(temp > 0)
            {
             temp /=10;
             numdigits++;
            }
        }
        int sumofpowers = 0;
        temp = n;
        while (temp > 0)
        {
         int digit = temp % 10;
         sumofpowers += pow(digit,numdigit);
         temp /= 10;
        }
        if (sumofpowers == originalnum)
        {
            printf("Armstrong\n");
        }
        else
        {
          printf("Not Armstrong");    
        }
    }
    return 0;
}