#include <bits/stdc++.h>
int v[1000100];
int main() {
  int n, r = 0, i, x;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    v[x]++;
    while (v[x] == 2) {
      v[x] = 0;
      x++;
      v[x]++;
    }
  }
  for (i = 0; i < 1000100; i++)
    if (v[i] == 1) r++;
  printf("%d", r);
  return 0;
}
