#include <bits/stdc++.h>
long long arr[1000006] = {};
long long counti[2000006] = {};
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long maxx = 0;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      counti[arr[i]]++;
    }
    for (long long i = 0; i < 2 * 1000002; i++) {
      if (counti[i] >= 2) {
        long long temp = counti[i] / 2;
        counti[i] -= 2 * temp;
        counti[i + 1] += temp;
      }
    }
    long long ans = 0;
    for (long long i = 0; i < 2 * 1000002; i++) {
      if (counti[i] != 0) {
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
