There is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting the selected vertices with color i. None of the sides were painted in multiple colors. Find the minimum value that can be considered as m.

Constraints

* 1 ≤ n ≤ 5
* 2 ≤ ai ≤ 109

Input


n
a1
.. ..
an


Output

Output the minimum value of m on one line.

Examples

Input

2
3
3


Output

5


Input

5
2
3
4
5
6


Output

12
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false);
	int n; cin >> n;
	ll sum = 0;
	vi v(n);
	REP(i, n)
	{
		cin >> v[i];
		sum += v[i];
		if (v[i] > 4) v[i] = 4;
	}
	sort(ALL(v));
	if (n == 1)
	{
		cout << sum << endl;
	}
	else if (n == 2)
	{
		cout << sum - 1 << endl;
	}
	else if (n == 3)
	{
		cout << sum - 3 << endl;
	}
	else if (n == 4)
	{
		if (v[0] == 2)
		{
			if (v[3] == 2) cout << sum - 4 << endl;
			else cout << sum - 5 << endl;
		}
		else cout << sum - 6 << endl;
	}
	else if (n == 5)
	{
		if (v[4] == 4)
		{
			if (v[0] == 2)
			{
				if (v[1] == 2) cout << sum - 7 << endl;
				else cout << sum - 8 << endl;
			}
			else
			{
				if (v[3] == 3) cout << sum - 8 << endl;
				else if (v[0] == 3) cout << sum - 9 << endl;
				else cout << sum - 10 << endl;
			}
		}
		else if(v[4] == 3)
		{
			if (v[1] == 3) cout << sum - 8 << endl;
			else if (v[3] == 2) cout << sum - 6 << endl;
			else cout << sum - 7 << endl;
		}
		else cout << sum - 6 << endl;
	}
	return 0;
}