#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 1000;
const int inf = 0x3f3f3f3f;
int cnt[maxn];
int n, tmp;
int main() {
  scanf("%d", &n);
  int t = 0, maxval = 0, minval = inf;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    cnt[tmp]++;
  }
  int ans = 0;
  for (int i = 0; i <= 1000100; i++) {
    cnt[i + 1] += cnt[i] / 2;
    cnt[i] %= 2;
    if (cnt[i] == 1) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
