#include <bits/stdc++.h>
using namespace std;
int cnt[1000009];
int main() {
  int n, a;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    cnt[a]++;
  }
  int count = 0;
  for (int i = 0; i <= 1000000; i++) {
    int p = cnt[i];
    if (p & 1) count++;
    cnt[i + 1] += p / 2;
  }
  long long sum = cnt[1000001];
  count += __builtin_popcountll(sum);
  printf("%d\n", count);
  return 0;
}
