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