#include <bits/stdc++.h>
using namespace std;
const int LINF = 1e18;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const int MOD2 = 998244353;
int gcd(int a, int b), lcm(int a, int b), expo(int e, int n);
bool cases = false;
void letsGO(int test) {
  int n;
  cin >> n;
  map<int, int> mp;
  map<int, int> mpl;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  int x = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    if (i->second > 0) {
      mp[i->first + 1] += (i->second) / 2;
      x += i->second % 2;
    }
  }
  cout << x << endl;
}
void speeeeeeeeeed() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
int expo(int e, int n) {
  return n ? n & 1 ? e * expo(e, --n) : expo(e * e, n / 2) : 1;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
signed main() {
  speeeeeeeeeed();
  cout << fixed << setprecision(10);
  int TT = 1, cnt = 0;
  if (cases) cin >> TT;
  while (TT--) letsGO(++cnt);
}
