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