#include <bits/stdc++.h>
using namespace std;
int app[1000010];
int main() {
  int n;
  set<int> all;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int cur;
    scanf("%d", &cur);
    all.insert(cur);
    app[cur]++;
  }
  int ans = 0;
  for (int i : all) {
    if (app[i]) {
      if (app[i] > 1) {
        all.insert(i + 1);
      }
      app[i + 1] += app[i] >> 1;
      ans += app[i] & 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
