1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <cmath>
using namespace std;
int tab[1000005];
int main ()
{long long n,a,p,x=0;
p==2;
cin>>n;
for (int i=0; i<n; i++)
	{
	cin>>a;
	tab[i]=pow(2,a);
	}
long long suma=0;
for (int i=0; i<n; i++) suma=suma+tab[i];
do 
	{
		suma=suma/2;
		x=x+1;
	}
while (suma/2!=0);
cout<<x;
	return 0;
}