#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 50;
const int INF = 0x3f3f3f3f;
const int Mod = 1000000007;
int s[maxn];
int t;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int ans = 0, maxs = -INF, mins = INF;
    memset(s, 0, sizeof(s));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &t);
      s[t]++;
      maxs = max(maxs, t);
      mins = min(mins, t);
    }
    for (int i = mins + 1; i <= maxs; i++) {
      s[i] = s[i] + s[i - 1] / 2;
      if (s[i - 1] & 1) ans++;
    }
    int tt = s[maxs];
    while (tt) {
      if (tt & 1) ans++;
      tt >>= 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
