#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> weights;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    weights.push_back(a);
  }
  vector<int> counts(1e6 + 100);
  for (auto w : weights) counts[w]++;
  for (int i = 0; i < counts.size() - 1; i++) {
    counts[i + 1] += counts[i] / 2;
    counts[i] -= 2 * (counts[i] / 2);
  }
  int steps = 0;
  for (int i = counts.size() - 1; i >= 0; i--) {
    while (counts[i]) {
      int num = 1;
      while (num <= counts[i]) num *= 2;
      num--;
      counts[i] -= num;
      steps++;
    }
  }
  cout << steps;
}
