Atoms: There and Back
Yura and Roma, after enjoying the game "Atoms," devised a new game: it starts with exactly one pile of atoms. In each move, you can select a number X and split any pile of atoms into two non-empty piles, ensuring that at least one of these new piles contains exactly X atoms. The game ends when no such number X can be chosen.
The details of who loses are not crucial here, as Roma has already divided the atoms into N piles and is curious: is it possible to reach this configuration in the new game?
Input
The first line contains a single integer N - the number of piles (1 ≤ N ≤ 10^5). The second line contains N space-separated integers A_i - representing the number of atoms in the i-th pile (1 ≤ A_i ≤ 10^18).
Output
Print YES on a single line if the current configuration can be achieved from one pile; otherwise, print NO.