#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int arr[1000000 + 200] = {};
  long n;
  cin >> n;
  int tab[n];
  long long wynik = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &tab[i]);
    arr[tab[i]]++;
  }
  for (int i = 0; i < 1000000 + 200; i++)
    if (arr[i]) {
      arr[i + 1] += arr[i] / 2;
      arr[i] %= 2;
      if (arr[i]) wynik++;
    }
  cout << wynik;
  return 0;
}
