#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> count(1000001, 0);
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    count[temp]++;
  }
  int result = 0;
  int index = 0;
  while (index < 1000000) {
    count[index + 1] += count[index] / 2;
    result += count[index] % 2;
    index++;
  }
  int valLast = count[1000000];
  while (valLast > 0) {
    if (valLast % 2 == 1) {
      result++;
    }
    valLast /= 2;
  }
  cout << result << endl;
}
