#include <bits/stdc++.h>
inline int read() {
  static char ch;
  bool sgn = false;
  while (ch = getchar(), ch < '0' || ch > '9')
    if (ch == '-') sgn = true;
  int res = ch - 48;
  while (ch = getchar(), ch >= '0' && ch <= '9') res = res * 10 + ch - 48;
  return sgn ? -res : res;
}
const int N = 1e6 + 5;
int n, num[N * 2];
int main() {
  n = read();
  for (int i = (1); i <= (n); ++i) ++num[read()];
  int m = 0, cur = 0;
  while (n > 0) {
    num[cur + 1] += num[cur] >> 1;
    n -= num[cur] >> 1;
    if (num[cur] & 1) ++m, n -= 1;
    ++cur;
  }
  printf("%d\n", m);
  return 0;
}
