#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int n;
int cnt[1000000 + 100];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; ++i) {
    int temp;
    cin >> temp;
    cnt[temp] += 1;
  }
  for (int i = 0; i <= 1000000 + 50; ++i) {
    cnt[i + 1] += cnt[i] / 2;
    cnt[i] %= 2;
  }
  int ans = 0;
  for (int i = 0; i <= 1000000 + 50; ++i) ans += cnt[i];
  cout << ans << endl;
}
