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 <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int n;
vint v;
vint tt;
vint used;
bool f=false;
int cnt=0;
int foo(int x);
int foo2(int c,int x,int y){
	if(c==0){
		return foo(x+1);
	}
	if(y>=n){
		return 0;
	}
	int ret=0;
	reep(i,y,n){
		if(v[i]<=c&&used[i]==0){
			used[i]=1;
			++cnt;
			if(foo2(c-v[i],x,i+1)&&cnt==n){
				return 1;
			}
			used[i]=0;
			--cnt;
		}
	}
	return 0;
}
int foo(int x){
	if(x==n){
		return 1;
	}
	if(used[x]==0) return 0;
	if(used[x]==2) return foo(x+1);
	int ret=0;
	used[x]=2;
	if(foo2(v[x],x,x+1)) return 1;
	used[x]=1;
	return foo(x+1);
}
void mainmain(){
	while(cin>>n,n){
		v=vint(n);
		rep(i,n){
			cin>>v[i];
		}
		sort(ALL(v));
		reverse(ALL(v));
		tt=vint(n,0);
		used=vint(n,0);
		// rep(i,n) cout<<used[i]<<" ";
		// cout<<endl;
		used[0]=1;
		tt[0]=v[0];
		cnt=1;
		if(foo(0)) cout<<"YES\n";
		else cout<<"NO\n";
	}
}



}
int main() try{
    mainmain();
}
catch(...){
}