#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[1100010];
int main(int argc, char const *argv[]) {
  memset(cnt, 0, sizeof(cnt));
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  int ans = 0;
  for (int i = 0; i <= 1e6 + 1000; i++)
    if (cnt[i]) {
      cnt[i + 1] += cnt[i] / 2;
      cnt[i] %= 2;
      if (cnt[i]) ans++;
    }
  printf("%d\n", ans);
  return 0;
}
