#include <bits/stdc++.h>
long long a[1100000];
int main() {
  long long n, w, i, count = 0;
  scanf("%I64d", &n);
  for (i = 0; i < n; i++) {
    scanf("%I64d", &w);
    a[w]++;
  }
  for (i = 0; i <= 1100000; i++) {
    a[i + 1] = a[i + 1] + a[i] / 2;
    a[i] = a[i] % 2;
    if (a[i] != 0) {
      count++;
    }
  }
  printf("%I64d", count);
  return 0;
}
