#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1234567890;
const long long int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-5;
template <class T>
inline T CHM(T a, T M) {
  return a >= M ? a % M : a;
}
template <class T>
inline T POW(T b, T e) {
  T multiply = 1;
  for (T i = 0; i < e; i++) multiply *= b;
  return multiply;
}
template <class T>
inline T POWMOD(T b, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * b) % M;
    b = (b * b) % M;
  }
  return (T)ret;
}
template <class T>
inline T MMI(T a, T M) {
  return POWMOD(a, M - 2, M);
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / gcd(a, b)) * b;
}
template <class T, class X>
inline bool getbit(T a, X i) {
  T t = 1;
  return ((a & (t << i)) > 0);
}
template <class T, class X>
inline T resetbit(T a, X i) {
  T t = 1;
  return (a & (~(t << i)));
}
template <class T, class X>
inline T setbit(T a, X i) {
  T t = 1;
  return (a | (t << i));
}
inline void speed() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int n, x;
void solve() {
  vector<int> v;
  int a = 1;
  while (a <= 1000005) {
    v.emplace_back(a);
    a *= 2;
  }
  cin >> n;
  int count[1000005] = {0};
  for (auto(i) = 0; (i) < (n); (i)++) {
    cin >> x;
    count[x]++;
  }
  for (auto(i) = 0; (i) < (1000001); (i)++) {
    if (count[i] > 1) {
      count[i + 1] = count[i + 1] + (count[i] / 2);
      count[i] %= 2;
    }
  }
  long long int ans = 0;
  for (auto(i) = 0; (i) < (1000001); (i)++) {
    ans += count[i];
  }
  for (int i = v.size() - 1; i >= 0; i--) {
    if (count[1000001] >= v[i]) {
      count[1000001] -= v[i];
      ans++;
    }
  }
  cout << ans;
}
int main() {
  speed();
  solve();
  return 0;
}
