#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000100;
int bit[MAXN];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int w;
    cin >> w;
    bit[w]++;
  }
  int step = 0;
  for (int i = 0; i < MAXN - 1; ++i) {
    bit[i + 1] += bit[i] / 2;
    bit[i] %= 2;
    step += bit[i];
  }
  cout << step << endl;
  return 0;
}
