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