#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, j;
  cin >> n;
  int a[1000020];
  for (int i = 0; i < 1000020; i++) {
    a[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> j;
    a[j]++;
  }
  j = 0;
  for (int i = 0; i < 1000020; i++) {
    if (a[i] != 0) {
      a[i + 1] += a[i] / 2;
      a[i] = a[i] % 2;
      if (a[i] != 0) {
        j++;
      }
    }
  }
  cout << j;
  return 0;
}
