#include <bits/stdc++.h>
using namespace std;
int app[2000005];
inline int scan_int(int &x) {
  register int c = getchar();
  if (c == EOF) return -1;
  x = 0;
  for (; ((c < 48 || c > 57)); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  return 0;
}
inline void print_int(int n) {
  register int N = n, rev, count = 0;
  rev = N;
  if (N == 0) {
    putchar('0');
    return;
  }
  while ((rev % 10) == 0) {
    count++;
    rev /= 10;
  }
  rev = 0;
  while (N != 0) {
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) {
    putchar(rev % 10 + '0');
    rev /= 10;
  }
  while (count--) putchar('0');
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int cur;
    scanf("%d", &cur);
    app[cur]++;
  }
  int ans = 0;
  for (int i = 0; i <= 2000000; i++) {
    if (app[i]) {
      app[i + 1] += app[i] >> 1;
      ans += app[i] & 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}
