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