#include <bits/stdc++.h>
using namespace std;
long long a[1001000];
int main() {
  long long n, i, j, ans, b;
  while (~scanf("%lld", &n)) {
    ans = 0;
    memset(a, 0, sizeof(a));
    for (i = 0; i <= n - 1; i++) {
      scanf("%lld", &b);
      a[b]++;
    }
    for (i = 0; i <= 1001000; i++) {
      if (a[i] != 0) {
        if (a[i] % 2 == 0) {
          a[i + 1] += a[i] / 2;
        } else {
          ans++;
          a[i + 1] += a[i] / 2;
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
