#include <bits/stdc++.h>
using namespace std;
int cati[1000105];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int i, x, maxim = 0;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x > maxim) maxim = x;
    cati[x]++;
  }
  int sol = 0;
  for (i = 0; i <= maxim; i++) {
    cati[i + 1] += cati[i] / 2;
    cati[i] = cati[i] % 2;
    sol += cati[i];
    if (i == maxim && cati[i + 1]) maxim++;
  }
  cout << sol << '\n';
  return 0;
}
