#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
int w[maxn];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(w, 0, sizeof(w));
    int temp;
    for (int i = 0; i < n; i++) {
      scanf("%d", &temp);
      w[temp]++;
    }
    int step = 0;
    for (int i = 0; i < maxn; i++) {
      w[i + 1] += (w[i] >> 1);
      if (w[i] & 1) step++;
    }
    printf("%d\n", step);
  }
  return 0;
}
