#include <stdio.h>
#include <math.h>

int main(){
    int n, t, d, c = 0, s = 0;
    scanf("%d",&n);
    
    if(n < 0) {
        printf("Invalid Input");
        return 0;
    }
    
    t = n;
    while(t){ c++; t /= 10; }
    
    t = n;
    while(t){
        d = t % 10;
        s += pow(d, c);
        t /=10;
    }
    
    printf(s == n ? "Armstrong" : "Not
    Armstrong");
}