1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    unsigned int tab[210000];
    unsigned int n, s;
    int d, b;

    cin>>n;
    for(int a=0;a<n;a++){

        cin>>tab[a];

        s=pow(2,tab[a])+s;

            if(tab[a]==1){

                d=d+1;
            }
        }
    if(d%2==1){
        s=s-2;
    }

    b=-1;
    for( unsigned long long x = 1; x <= s; x *= 2 ){
        b=b+1;
    }
    cout<<endl<<endl;
    cout<<b;
}