#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int max_ai = 1e6 + 100;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  long long a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long fre[max_ai];
  memset(fre, 0, sizeof(fre));
  for (int i = 1; i <= n; i++) fre[a[i]]++;
  long long sum = 0;
  for (int i = 0; i < max_ai; i++) {
    fre[i + 1] += fre[i] / 2;
    fre[i] = fre[i] % 2;
    sum += fre[i];
  }
  cout << sum << endl;
  return 0;
}
