#include <bits/stdc++.h>
int n, maxn, x, ans, table[1000030];
inline int max(int x, int y) { return (x > y ? x : y); }
int main() {
  scanf("%d", &n);
  maxn = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    table[x]++;
    maxn = max(maxn, x);
  }
  ans = 0;
  for (int i = 0; (i <= maxn) || (table[i]); i++) {
    table[i + 1] += table[i] / 2;
    table[i] %= 2;
    ans += table[i];
  }
  printf("%d", ans);
  return 0;
}
