#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000100;
int main() {
  long long n, cnt[MAX], i, k, ans, temp;
  cin >> n;
  for (i = 0; i <= 1000001; ++i) {
    cnt[i] = 0;
  }
  for (i = 0; i < n; ++i) {
    scanf("%I64d", &k);
    ++cnt[k];
  }
  i = 0;
  ans = 0;
  while (i <= 1000000) {
    if (cnt[i] > 1) {
      cnt[i + 1] += (cnt[i] / 2);
      cnt[i] = cnt[i] % 2;
    }
    if (cnt[i] == 1) {
      ++ans;
    }
    ++i;
  }
  if (cnt[1000001] > 0) {
    temp = cnt[1000001];
    while (temp != 0) {
      ans += (temp % 2);
      temp /= 2;
    }
    ans += temp;
  }
  cout << ans << endl;
  return 0;
}
