#include <bits/stdc++.h>
using namespace std;
int vet[1001000];
int main() {
  int n, i, aux;
  int total;
  while (scanf("%d", &n) == 1) {
    memset(vet, 0, sizeof(vet));
    for (i = 0; i < n; i++) {
      scanf("%d", &aux);
      vet[aux]++;
    }
    for (total = 0, i = 0; i < 1001000; i++) {
      total += vet[i] % 2;
      if (i + 1 < 1001000) {
        vet[i + 1] += vet[i] / 2;
      }
    }
    printf("%d\n", total);
  }
  return 0;
}
