#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T LCM(T a, T b) {
  return a * (b / gcd(a, b));
}
template <typename T>
T expo(T b, T e, const T &m) {
  if (e <= 1) return e == 0 ? 1 : b;
  return (e & 1) == 0 ? expo((b * b) % m, e >> 1, m)
                      : (b * expo((b * b) % m, e >> 1, m)) % m;
}
template <typename T>
T modinv(T a) {
  return expo(a, 1000000007ll - 2, 1000000007ll);
}
template <class T, class second>
std::ostream &operator<<(std::ostream &os, const std::pair<T, second> &t) {
  os << "(" << t.first << ", " << t.second << ")";
  return os;
}
template <class T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &t) {
  os << "[";
  for (__typeof(t.begin()) it = t.begin(); it != t.end(); it++) {
    if (it != t.begin()) os << ", ";
    os << *it;
  }
  os << "]";
  return os;
}
namespace variadic {
template <typename T>
T min(T v) {
  return v;
}
template <typename T, typename... Args>
T min(T f, Args... args) {
  return std::min(f, min(args...));
}
template <typename T>
T max(T v) {
  return v;
}
template <typename T, typename... Args>
T max(T f, Args... args) {
  return std::max(f, max(args...));
}
}  // namespace variadic
long long n;
int freq[1100002] = {0};
int lsb(int x) {
  int res = 0;
  while (res < 30) {
    if (x & (1 << res)) return res;
    res++;
  }
  assert(false);
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  int a;
  for (__typeof(n) i = 0; i < n; i++) {
    cin >> a;
    freq[a]++;
  }
  for (__typeof(1100002) i = 0; i < 1100002; i++) {
    bool flag = false;
    if (freq[i] % 2 == 1) {
      flag = true;
    }
    while (freq[i] > 0) {
      if (lsb(freq[i]) > 0) freq[i + lsb(freq[i])]++;
      freq[i] = freq[i] & (freq[i] - 1);
    }
    if (flag) freq[i] = 1;
  }
  long long answer = 0;
  for (__typeof(1100002) i = 0; i < 1100002; i++) {
    answer += (long long)freq[i];
  }
  cout << answer << '\n';
  return 0;
}
