fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3. typedef long long ll;
  4. int main() {
  5. int N; cin >> N;
  6. ll res = 0;
  7. for (int i = 0; i < N; i++){
  8. ll b = 1;
  9. int c; cin >> c;
  10. for (int i = 0; i < c; i++){
  11. b *= 2;
  12. }
  13. res += b;
  14. }
  15. int ans = 0;
  16. while (res > 1){
  17. res /= 2LL;
  18. ans++;
  19. }
  20. cout << ans << endl;
  21. return 0;
  22. }
Success #stdin #stdout 0s 3416KB
stdin
4
1
1
1
2
stdout
3