#include <bits/stdc++.h>
using namespace std;
const int limit = 1e6 + 2;
int c[limit];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int temp;
    cin >> temp;
    ++c[temp];
  }
  int total = 0;
  for (int i = 0; i < limit; ++i) {
    if (c[i] > 1) {
      int res = c[i] / 2;
      if (c[i] & 1) ++total;
      if (i + 1 < limit)
        c[i + 1] += res;
      else {
        while (res) {
          if (res & 1) ++total;
          res /= 2;
        }
      }
    } else if (c[i])
      ++total;
  }
  cout << total << "\n";
  return 0;
}
