#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000;
int n, w[1000001] = {0};
int main() {
  cin >> n;
  int tmp;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    w[tmp]++;
  }
  int ans = 0;
  for (int i = 0; i < INF; i++) {
    if (w[i] >= 2) {
      w[i + 1] += w[i] / 2;
      w[i] = w[i] % 2;
    }
    ans += w[i];
  }
  for (int i = 0; i < 32; i++) {
    if (((1 << i) & w[INF]) != 0) ans++;
  }
  cout << ans;
  return 0;
}
