#include <bits/stdc++.h>
using namespace std;
int n, counter[2000010];
int main() {
  int i, x, res;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    counter[x]++;
  }
  res = 0;
  for (i = 0; (i + 1) < 2000010; i++) {
    res += (counter[i] & 1);
    counter[i + 1] += (counter[i] >> 1);
  }
  printf("%d\n", res);
  return 0;
}
