#include <bits/stdc++.h>
using namespace std;
int n;
int mas[2000007];
int w;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &w);
    mas[w]++;
  }
  int res = 0;
  for (int i = 0; i <= 1001000; i++) {
    mas[i + 1] += mas[i] / 2;
    mas[i] = mas[i] % 2;
    if (mas[i] == 1) res++;
  }
  printf("%d", res);
}
