#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, temp, ans = 0;
map<int, int> m;
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) {
    scanf("%d", &temp);
    m[temp]++;
  }
  for (int temp = (0); temp <= (1001000); temp++) {
    if (m[temp] > 1) {
      int p = 0;
      while (m[temp] > 1) {
        m[temp] -= 2;
        p++;
      }
      m[temp + 1] += p;
    }
  }
  map<int, int>::iterator it;
  for (it = m.begin(); it != m.end(); it++) {
    if (it->second > 0) ans++;
  }
  printf("%d\n", ans);
}
