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