#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// string q=s.insert(0,str);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
// sort(v.rbegin(),v.rend());
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}
bool comp(int a,int b)
{
	return (a<b);
	// cout<<min({a,b,c,d},comp)<<endl;
}


int main(void)
{
	fast();
	ll n;
	cin>>n;
	ll x;
	map<ll,ll> m;
	for(ll i=0;i<n;i++)
	{
		cin>>x;
		m[x%200]++;
	}
	ll ans = 0;
	for(auto it=m.begin();it!=m.end();it++)
	{
		ans += ((it->second)*(it->second-1))/2;
	}
	cout<<ans<<endl;
}
/** I can do this all day **/

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define SZ(x)			    		(int)x.size()
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);

const int N = 1e5 + 10;
const ll mod = 1e9 + 7;
const ll mod2 = 998244353;
const ll inf = 8e18;
const int LOG = 22;

ll pw(ll a , ll b, ll M)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M : pw(a * a % M, b / 2, M))); }

int n, A[N];

bitset < N > bt;

int main()
{
	cin >> n;
	bt[0] = 1;
	int sum = 0, tot = 1e9;
	for(int i = 1; i <= n; i ++)
	{
		cin >> A[i];
		bt |= bt << A[i];
		sum += A[i];
	}
	for(int i = 0; i < N ;i ++)
	{
		if(bt[i])
		{
			tot = min(tot, max(i, sum - i));
		}
	}
	cout << tot << endl;
    return 0;
}

/** test corner cases(n = 1?) watch for overflow or minus indices **/

