Problem: Beakers of various capacities are given. First, choose one of the largest beakers and pour it through the faucet until it is full. Next, transfer the water from the beaker to another beaker according to the following rules.

* All water in the beaker must be transferred to another beaker without leaving. However, if it is not possible to transfer all the water to one beaker, it may be divided into multiple beakers.
* When you fill the beaker with water, you must pour water until it is full. Also, do not spill water.
* Do not pour water from multiple beakers into the same beaker at once.
* Only water the same beaker once.

<image>



When following this rule, create a program that inputs the number of beakers n and the capacity of each beaker, determines whether water can be poured into all beakers, and outputs it. Output YES (half-width uppercase letters) when water can be poured into all beakers, and NO (half-width uppercase letters) when water cannot be poured.



Input

A sequence of multiple datasets is given as input. The end of the input is indicated by a single line of zeros. Each dataset is given in the following format:


n
c1 c2 ... cn


The number of beakers n (1 ≤ n ≤ 50) is given on the first line. The second line is given the integer ci (1 ≤ ci ≤ 100), which represents the capacity of the i-th beaker.

The number of datasets does not exceed 105.

Output

The judgment result is output to one line for each data set.

Example

Input

10
11 2 23 4 2 12 8 5 2 10
8
2 1 3 11 2 3 1 4
9
5 9 1 2 4 8 17 1 8
8
3 38 9 4 18 14 19 5
1
1
0


Output

YES
YES
YES
NO
YES

Solution (in CPP):

Solution:
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int n;
int C[50];
bool used[50];
bool full[50];
set<ll> visited[101];

bool searchFrom();

void dump()
{
	rep(i, n){
		printf("%d", C[i]);
		if(full[i])
			printf("[o]");
		else if(used[i])
			printf("[ ]");
		else
			printf("[x]");
	}
	puts("");
}

bool searchTo(int v, int src)
{
	/*
	ll mask = 0;
	reps(i, src+1, n){
		if(C[i]<=v && !used[i])
			mask |= 1ll << i;
	}
	if(visited[v].find(mask) != visited[v].end())
		return false;
	visited[v].insert(mask);
	*/
	
	reps(i, src+1, n){
		if(!used[i]){
			full[i] = used[i] = true;
			if(C[i] == v){
				if(searchFrom())
					return true;
			}
			else if(C[i] < v && searchTo(v-C[i], i))
				return true;
			full[i] = used[i] = false;
		}
	}
	
	return false;
}

bool searchFrom()
{
	int unused = -1;
	rep(i, n){
		if(!used[i]){
			unused = i;
			break;
		}
	}
	if(unused == -1)
		return true;
	
	rep(i, unused){
		if(full[i]){
			full[i] = false;
			if(searchTo(C[i], i))
				return true;
			full[i] = true;
		}
	}
	return false;
}

int main()
{
	while(scanf("%d", &n), n){
		rep(i, n)
			scanf("%d", &C[i]);
		
		rep(i, 101)
			visited[i].clear();
		sort(C, C+n, greater<int>());
		fill(used, used+n, false);
		fill(full, full+n, false);
		used[0] = full[0] = true;
		puts(searchFrom() ? "YES" : "NO");
	}
	return 0;
}