#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  vector<int> a(1000001, 0);
  for (int i = 0; i < n; ++i) {
    int b;
    scanf("%d", &b);
    a[b]++;
  }
  int ans = 0;
  for (int i = 0; i < a.size() - 1; ++i) {
    if (a[i] % 2) {
      ++ans;
    }
    a[i + 1] += a[i] / 2;
  }
  m = a.back();
  while (m) {
    if (m % 2) {
      ++ans;
    }
    m /= 2;
  }
  cout << ans;
  return 0;
}
