#K92012. Festival Harmony

    ID: 38103 Type: Default 1000ms 256MiB

Festival Harmony

Festival Harmony

In the annual village festival, villagers perform using two types of instruments: string instruments (denoted by 0) and percussion instruments (denoted by 1). The festival is considered HARMONIOUS if the number of villagers playing string instruments is an exact multiple of those playing percussion instruments. More formally, if we denote:

  • s as the number of string instrument players, and
  • p as the number of percussion instrument players,

then the festival is harmonious if either p = 0 or $$s \mod p = 0$$. Otherwise, it is NOT HARMONIOUS.

You are given the number of villagers and a list representing the instrument each villager plays. Your task is to determine whether the festival is HARMONIOUS or NOT HARMONIOUS.

inputFormat

The input is given via standard input (stdin) in the following format:

  1. The first line contains a single integer N, representing the number of villagers.
  2. The second line contains N space-separated integers, each being either 0 or 1, where 0 denotes a villager playing a string instrument and 1 denotes one playing a percussion instrument. If N is 0, the second line may be omitted.

outputFormat

Output a single line to standard output (stdout) containing either HARMONIOUS or NOT HARMONIOUS based on the condition described.

## sample
3
0 0 1
HARMONIOUS

</p>