#include <bits/stdc++.h>
int main() {
  int N;
  int frqs[1000200];
  for (int i = 0; i < 1000200; i++) frqs[i] = 0;
  scanf("%d", &N);
  for (int i = 0, a; i < N; i++) {
    scanf("%d", &a);
    frqs[a]++;
  }
  int tot = 0;
  for (int i = 0; i < 1000200; i++) {
    frqs[i + 1] += (frqs[i]) / 2;
    frqs[i] %= 2;
    tot += (frqs[i] == 1 ? 1 : 0);
  }
  printf("%d", tot);
  return 0;
}
