#C9287. Equalize Array Elements

    ID: 53363 Type: Default 1000ms 256MiB

Equalize Array Elements

Equalize Array Elements

You are given an array of n non-negative integers. Your task is to determine whether it is possible to make all elements of the array equal by performing a series of operations. Although the operations are not specified, it can be proven that the only thing that matters is whether the average of the numbers is an integer. In other words, if the sum of all numbers is divisible by n, then the answer is YES; otherwise, it is NO.

Formally, given an array \( B = [b_1, b_2, \dots, b_n] \), check if \[ \frac{\sum_{i=1}^n b_i}{n} \in \mathbb{Z}. \] If yes, print YES, otherwise print NO.

inputFormat

The first line contains a single integer n (\(1 \leq n \leq 10^5\)), representing the number of elements in the array. The second line contains n non-negative integers separated by spaces, where each integer \(b_i\) (\(0 \leq b_i \leq 10^9\)).

outputFormat

Output a single line containing YES if it is possible to make all the array elements equal, otherwise NO.

## sample
3
1 2 3
YES