#include <bits/stdc++.h>
using namespace std;
long long c[5000000];
int main() {
  long long n, i, p = 0, q = 2000000, b = 0, f = 0, x, j;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &x);
    if (x > p) p = x;
    if (x < q) q = x;
    c[x]++;
    j = 0;
    while (1) {
      if (c[x + j] == 2) {
        c[x + j] = 0;
        j++;
        c[x + j]++;
        if ((x + j) > p) p = x + j;
      } else
        break;
    }
  }
  for (i = q; i <= p; i++) {
    while (c[i]) {
      b += c[i] % 2;
      c[i] = c[i] / 2;
    }
  }
  printf("%lld\n", b);
  return 0;
}
