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