You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
572 B
33 lines
572 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
|
|
vector<int> count(81, 0);
|
|
for (int i = 0; i < n; ++i) {
|
|
int num;
|
|
cin >> num;
|
|
count[num]++;
|
|
}
|
|
|
|
for (int i = 1; i <= 80; ++i) {
|
|
if (count[i] >= 2) {
|
|
count[i + 1] += count[i] / 2;
|
|
count[i] %= 2;
|
|
}
|
|
}
|
|
|
|
int max_num = 0;
|
|
for (int i = 1; i <= 80; ++i) {
|
|
if (count[i] > 0) {
|
|
max_num = i;
|
|
}
|
|
}
|
|
|
|
cout << max_num << endl;
|
|
|
|
return 0;
|
|
}
|