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