#include <bits/stdc++.h>
using namespace std;
vector<int> cnt(1000009 + 2 * log(1000000), 0);
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    cnt[a]++;
  }
  int ans = 0;
  for (int i = 0; i <= 1000000 + 2 * log(1000000); i++) {
    int a = i, b = cnt[i];
    if (b) {
      cnt[a + 1] += b / 2;
      b %= 2;
      if (b) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
