#include <bits/stdc++.h>
using namespace std;
const int DI[] = {-1, 0, 1, 0};
const int DJ[] = {0, 1, 0, -1};
const int MAXINT = 0x7fffffff;
const int BIGINT = 0x20000000;
const long long MAXLL = 0x7fffffffffffffffLL;
const long long BIGLL = 0x2000000000000000LL;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T powmod(T a, T b, T m) {
  T r = 1;
  a %= m;
  for (; b; b >>= 1) {
    if (b & 1) r = r * a % m;
    a = a * a % m;
  }
  return r;
}
int main() {
  int n;
  scanf("%d", &n);
  map<int, int> cnt;
  for (int i = 0; i < n; ++i) {
    int num;
    scanf("%d", &num);
    ++cnt[num];
  }
  for (auto p = cnt.begin(); p != cnt.end(); ++p) {
    if (p->second > 1) {
      cnt[p->first + 1] += p->second / 2;
      p->second &= 1;
    }
  }
  int ret = 0;
  for (auto p : cnt) {
    ret += p.second != 0;
  }
  printf("%d\n", ret);
}
