#include <bits/stdc++.h>
using namespace std;
long long a[1000005];
long long c[2000015];
long long n;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  long long ma = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c[a[i]]++;
    ma = max(ma, a[i]);
  }
  long long ans = 0;
  for (int i = 0; i < 2000010; i++) {
    if (c[i] % 2 == 1) {
      c[i + 1] += c[i] / 2;
      c[i] = 1;
    } else {
      c[i + 1] += c[i] / 2;
      c[i] = 0;
    }
  }
  for (int i = 0; i < 2000010; i++) {
    ans += c[i];
  }
  cout << ans << "\n";
  return 0;
}
