#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
int a[1010000];
int main() {
  int n, ans = 0;
  n = in();
  for (int i = 1; i <= n; i++) a[in()]++;
  for (int i = 0; i <= 1010000; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
    if (a[i]) ans++;
  }
  printf("%d", ans);
}
