#include <bits/stdc++.h>
using namespace std;
inline long long tavan(long long a, long long b) {
  return (b) ? (tavan((a) * (a), (b) >> 1) * ((b)&1 ? (a) : 1)) : 1;
}
inline long long tavan(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
inline long double tavan(long double a, long long b) {
  return (b) ? (tavan((a) * (a), (b) >> 1) * ((b)&1 ? (a) : 1)) : 1;
}
inline long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a = a % b)
    ;
  return a;
}
ifstream fin("input.txt");
ofstream fout("output.txt");
const long double PI = ((long double)2 * asin(1));
const long long INF = ((long long)1e14);
const long long MOD = ((long long)1e9 + 7);
const long long N = 1001 * 1000;
long long n, a, cnt[N], ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a, cnt[a]++;
  for (int i = 0; i < N; i++) {
    ans += cnt[i] % 2;
    cnt[i + 1] += cnt[i] / 2;
  }
  cout << ans;
  return 0;
}
