#include <bits/stdc++.h>
#pragma commet(linker, "/STACK:256000000")
using namespace std;
template <class T>
inline const T sqr(const T& x) {
  return x * x;
}
template <class T>
inline bool isIn(const T& a, const T& b, const T& x) {
  return a <= x && x < b;
}
const int INF = 1e9 + 7;
const long long LINF = 1e17 + 7;
const long double EPS = 1e-13;
const string fileName = "space-cat";
void run();
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(13);
  run();
  return 0;
}
void run() {
  int n;
  cin >> n;
  const int MAXN = 1000 * 1000;
  vector<int> vec(MAXN + 10);
  int a;
  int result = 0;
  for (int i = 0; i < n; cin >> a, ++vec[a], ++i)
    ;
  for (int i = 0; i < vec.size() - 1; ++i) {
    if (vec[i] & 1) {
      ++result;
    }
    vec[i + 1] += vec[i] >> 1;
  }
  while (vec.back()) {
    result += vec.back() & 1;
    vec.back() >>= 1;
  }
  cout << result;
}
