#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, ans = 0, n, wei[2000005] = {}, k = (int)2e6;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    wei[x]++;
  }
  for (int i = 0; i <= k; i++)
    if (wei[i]) {
      wei[i + 1] += wei[i] / 2;
      wei[i] %= 2;
      ans += wei[i];
    }
  ans += wei[k + 1];
  cout << ans << endl;
  return 0;
}
