#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int c, count = 0, num = 0, answer = 0;
  cin >> c;
  int array[c];
  for (int i = 0; i < c; i++) cin >> array[i];
  sort(array, array + c);
  for (int i = 0; i < c; i++) {
    if (array[i] != num) {
      while (num != array[i]) {
        if (count & 1) answer++;
        count >>= 1;
        num++;
        if (count == 0) num = array[i];
      }
    }
    count++;
  }
  while (num != 100000000) {
    if (count & 1) answer++;
    count >>= 1;
    num++;
    if (count == 0) num = 100000000;
  }
  cout << answer << '\n';
  return 0;
}
