#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp;
  cin >> n;
  vector<long long> weights(1000001, 0);
  for (int i = 0; i < n; i++) {
    cin >> temp;
    weights[temp]++;
  }
  for (int i = 0; i < 1000001; i++) {
    if (i == 1000000) {
      while (weights[i] > 1) {
        n -= weights[i] / 2;
        weights[i] -= weights[i] % 2;
        weights[i] -= weights[i] / 2;
      }
      break;
    }
    weights[i + 1] += weights[i] / 2;
    n -= weights[i] / 2;
  }
  cout << n << endl;
}
