#include <bits/stdc++.h>
using namespace std;
int ara[1000005];
int mp[1000005 + 1000];
int main() {
  int i, j, k;
  int n, mx = 0, cnt = 0;
  cin >> n;
  for (i = 0; i < n; ++i) {
    scanf("%d", &ara[i]);
    mp[ara[i]]++;
    mx = max(mx, ara[i]);
  }
  for (i = 0; i <= mx; ++i) {
    mp[i + 1] += mp[i] / 2;
    if (mp[i + 1]) mx = max(mx, i + 1);
    mp[i] %= 2;
    cnt += mp[i];
  }
  cout << cnt << endl;
}
