#include <bits/stdc++.h>
using namespace std;
int N;
int cnt[1000105];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int w;
    scanf("%d", &w);
    cnt[w]++;
  }
  int res = 0;
  for (int w = 0; w <= 1000100; w++) {
    int pMax = 0;
    while ((1 << (pMax + 1)) <= cnt[w]) {
      pMax++;
    }
    for (int i = pMax; i >= 1; i--) {
      if ((1 << i) <= cnt[w]) {
        cnt[w + i]++;
        cnt[w] -= (1 << i);
      }
    }
    if (cnt[w]) {
      res++;
    }
  }
  printf("%d\n", res);
}
