#include <iostream>
using namespace std;
typedef long long ll;
int main() {
int N; cin >> N;
ll res = 0;
for (int i = 0; i < N; i++){
ll b = 1;
int c; cin >> c;
for (int i = 0; i < c; i++){
b *= 2;
}
res += b;
}
int ans = 0;
while (res > 1){
res /= 2LL;
ans++;
}
cout << ans << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKaW50IG1haW4oKSB7CglpbnQgTjsgY2luID4+IE47CglsbCByZXMgPSAwOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspewoJCWxsIGIgPSAxOwoJCWludCBjOyBjaW4gPj4gYzsKCQlmb3IgKGludCBpID0gMDsgaSA8IGM7IGkrKyl7CgkJCWIgKj0gMjsKCQl9CgkJcmVzICs9IGI7Cgl9CglpbnQgYW5zID0gMDsKCXdoaWxlIChyZXMgPiAxKXsKCQlyZXMgLz0gMkxMOwoJCWFucysrOwoJfQoJY291dCA8PCBhbnMgPDwgZW5kbDsKCXJldHVybiAwOwp9