#include <bits/stdc++.h>
using namespace std;
long long n, w[1000100] = {0}, steps = 0, x;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    w[x]++;
  }
  for (int i = 0; i < 1000050; i++) {
    if (w[i] == 1) {
      steps++;
      continue;
    } else
      w[i + 1] += w[i] / 2;
    if (w[i] % 2 == 1) steps++;
  }
  cout << steps << endl;
  return 0;
}
