#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> vis(4000001);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    vis[a[i]]++;
  }
  long long ans = 0;
  for (long long i = 0; i < vis.size(); i++) {
    vis[i + 1] += (vis[i] / 2);
    vis[i] %= 2;
    if (vis[i]) ans++;
  }
  cout << ans;
  return 0;
}
