100 1
85 75 55 65 39 26 47 16 9 11 3 4 70 23 56 64 36 34 16 13 18 28 32 80 8 79 76 4 21 75 93 51 85 86 100 88 91 71 97 28 66 22 47 87 91 95 3 56 81 53 88 90 21 30 74 45 58 73 36 40 70 51 28 75 20 54 69 52 14 48 52 53 91 81 32 68 16 48 60 66 91 32 55 42 93 51 3 46 23 64 39 1 30 42 20 83 99 29 35 59
 30 2
10 5 46 30 28 18 24 35 73 2 10 24 72 86 97 95 71 12 14 57 27 94 81 59 43 77 22 58 16 96
 30 3
20 37 89 77 74 6 52 87 19 58 3 38 40 38 42 12 1 23 29 38 12 65 15 1 92 45 23 94 61 73
 100 33
84 70 12 53 10 38 4 66 42 1 100 98 42 10 31 26 22 94 19 43 86 5 37 64 77 98 81 40 17 66 52 43 5 7 79 92 44 78 9 95 10 86 42 56 34 91 12 17 26 16 24 99 11 37 89 100 60 74 32 66 13 29 3 24 41 99 93 87 85 74 5 3 70 46 23 12 43 10 24 32 95 2 57 86 29 100 29 62 17 24 4 40 40 73 29 11 69 89 10 31
 8 6
19 15 1 14 7 2 10 14
 10 7
26 11 10 8 5 20 9 27 30 9
 100 3
92 51 91 67 32 97 40 24 78 72 93 90 57 77 66 13 55 24 17 90 65 35 69 97 79 31 85 2 90 80 49 44 73 77 34 45 74 75 35 14 34 56 60 54 36 55 16 49 12 54 92 68 70 71 5 79 67 89 64 80 20 84 4 39 55 84 53 59 68 11 89 89 15 73 67 86 91 78 49 24 58 83 55 34 82 97 27 29 78 15 20 48 9 87 41 34 91 76 82 44
 20 5
33 45 36 13 46 40 15 11 29 44 43 50 14 19 46 46 46 26 42 6
 3 4
3 8 2
 10 10
20 82 19 82 18 96 40 99 87 2
 50 13
53 55 51 81 59 22 11 20 30 80 38 17 8 38 69 52 11 74 16 38 80 97 39 74 78 56 75 28 4 58 80 88 78 89 95 8 13 70 36 29 49 15 74 44 19 52 42 59 92 37
 3 1
8 3 2
 5 1
4 7 9 5 7
 1 3
3
 20 2
4 2 6 9 8 4 4 7 2 3 7 7 10 6 3 5 2 9 8 5
 10 10
75 52 78 83 60 31 46 28 33 17
 8 5
5 2 17 12 16 12 17 3
 3 2
95 25 49
 100 12
90 59 100 12 82 31 66 28 7 13 43 42 48 94 60 32 20 92 37 39 22 55 14 23 77 56 21 55 10 89 93 79 5 80 40 80 6 15 56 82 68 61 32 100 23 7 13 92 32 82 17 85 49 85 13 75 4 7 42 14 84 22 50 12 11 75 4 85 32 96 56 13 34 100 66 37 58 58 24 58 81 63 59 55 89 97 90 69 29 11 71 58 58 43 72 96 81 72 14 64

4801
 1208
 1021
 1467
 16
 43
 4839
 375
 5
 325
 1012
 5
 17
 0
 21
 233
 14
 151
 2377

/*
─────────▄██████▀▀▀▀▀▀▄
─────▄█████████▄───────▀▀▄▄
──▄█████████████───────────▀▀▄
▄██████████████─▄▀───▀▄─▀▄▄▄──▀▄
███████████████──▄▀─▀▄▄▄▄▄▄────█
█████████████████▀█──▄█▄▄▄──────█
███████████──█▀█──▀▄─█─█─█───────█
████████████████───▀█─▀██▄▄──────█
█████████████████──▄─▀█▄─────▄───█
█████████████████▀███▀▀─▀▄────█──█ // “Make it work, make it right, make it fast.”
████████████████──────────█──▄▀──█
████████████████▄▀▀▀▀▀▀▄──█──────█
████████████████▀▀▀▀▀▀▀▄──█──────█
▀████████████████▀▀▀▀▀▀──────────█
──███████████████▀▀─────█──────▄▀
──▀█████████████────────█────▄▀
────▀████████████▄───▄▄█▀─▄█▀
──────▀████████████▀▀▀──▄███
──────████████████████████─█
─────████████████████████──█
────████████████████████───█
────██████████████████─────█
────██████████████████─────█
────██████████████████─────█
────██████████████████─────█
────██████████████████▄▄▄▄▄█
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef std::string str;
#define sei set<int>
#define sell set<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vld vector<ld>
#define vstr vector<str>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(v) v.begin(),v.end()
#define all_(v) v.rbegin(),v.rend()
#define foa(i,v) for(auto i : v)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>=b;i--)
#define tt ll t; cin>>t; while(t--)
#define M1(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define deb(x)  cerr << #x << " = " << x << endl
#define pb push_back
#define F first
#define S second
#define N 1000005
#define M 1000000007
#define OK order_of_key
#define FO find_by_order
#define nmax 1000100
#define stdinout freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define bolt                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ld PI = 3.141592653589793238462643383279;
const ll inf = std::numeric_limits<ll>::max();
const int infint = std::numeric_limits<int>::max();
const ll mod = 1e9+7;
using namespace __gnu_pbds;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

 
//Prime Numbers
 
vector<bool>prime(N+1,true);
void sieve()
{
	ll i,j,k;
	prime[0]=prime[1]=false;
	for(i=2;i*i<=N;i++)
	{
		if(prime[i])
		{
			for(j=i*i;j<=N;j++)
			{
				prime[j]=false;
			}
		}
	}
}
//Exponentiation
 
ll power(ll a,ll b)
{
	ll r=1;
	while(b)	
	{
		if(b%2==1)
			r=r*a;
		b/=2;
		a*=a;		
	}
	return r;
}
ll power(ll a,ll b,ll m)
{
	a=a%m;
	ll r=1;
	while(b)	
	{
		if(b%2==1)
			r=(r*a)%m;
		b/=2;
		a=(a*a)%m;		
	}
	return r;
}
 
//Prime Factors
 
vector<ll> factors(ll n)
{
	vector<ll>r;
	ll i,j;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			r.push_back(i);
			if(n/i!=i)
				r.push_back(n/i);
		}
	}
	return r;
}
 
//GCD
ll gcd(ll a,ll b)
{
	if(b>a)
	{
		ll t=a;
		a=b;
		b=t;
	}
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return (a*b)/gcd(a,b);
}
//Graphs
vector<bool>bvisited(N,false);
map<ll,ll>level;
ll ans=INT64_MAX;
vector<ll> bfs(ll V,vector<vector<ll>>G,ll s, ll e)
{
	vector<ll>order;
	queue<ll>q;
	q.push(s);
	level[s]=0;
	while(!q.empty())
	{
		s=q.front();
		q.pop();
		bvisited[s]=true;
		//order.push_back(s);
		if(s==e)
		{
			ans=ans>level[s]?level[s]:ans;
			return order;
		}
		if(s>20000)
			continue;
		for(auto x:G[s])
		{
			if(!bvisited[x])
			{
				q.push(x);
				level[x]=level[s]+1;
			}
		}
	}
	return order;
}
 
vector<bool>dvisited(N,false);
vector<ll> dfs(ll V,ll e,ll s)
{
	vector<ll>order;
	stack<ll>q;
	q.push(s);
	level[s]=1;
	while(!q.empty())
	{
		ll v=q.top();
		q.pop();
		if(v==e)
		{
			ans=ans>level[v]?level[v]:ans;
			continue;
		}
		if(!dvisited[2*v] && 2*v<=2*e)
		{
			q.push(2*v);
			level[2*v]=level[v]+1;
		}
		if(!dvisited[v-1])
		{
			q.push(v-1);
			level[v-1]=level[v]+1;
		}
	}
	return order;
}
 
bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.second < b.second); }
int main()
{
    bolt;
    stdinout;
    int n,a;
    vi v(n);
    fo(i,0,n)
        cin>>v[i];
    int res=0;
    fo(i,0,n){
        fo(i,0,3){
            if(v[i]>=a)
                v[i]-=a;
            else
                break;
        }
    }
    cout<<res<<endl;
    return 0;
}