#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),
      cout << fixed << setprecision(20);
  long long n;
  cin >> n;
  multiset<long long> q;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    q.insert(a);
  }
  long long ans = 0;
  while (q.size()) {
    auto it = q.begin();
    auto rit = it;
    rit++;
    auto y = *it;
    if (rit != q.end() && *rit == *it) {
      q.erase(it);
      q.erase(rit);
      q.insert(y + 1);
    } else {
      q.erase(it);
      ans++;
    }
  }
  cout << ans;
}
