#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
long long n;
int nr, fr[1010002];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> nr, fr[nr]++;
  for (int i = 0; i <= 1010000; ++i) {
    fr[i + 1] += fr[i] / 2;
    fr[i] %= 2;
  }
  int sol = 0;
  for (int i = 1010000; i >= 0; --i) sol += fr[i];
  cout << sol;
  return 0;
}
