#include <bits/stdc++.h>
const int MaxN = 1e6 + 255;
const long long INF = 1e18 + 7;
const int Mod = 1e9 + 7;
using namespace std;
long long n, a, f[MaxN], ans;
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a);
    ++f[a];
  }
  for (int i = 0; i < MaxN; ++i) {
    if (f[i]) {
      f[i + 1] += f[i] / 2;
      f[i] %= 2;
    }
  }
  for (int i = 0; i < MaxN; ++i)
    if (f[i]) ++ans;
  printf("%lld", ans);
  return 0;
}
