#include <bits/stdc++.h>
using namespace std;
int res[1001110];
int main(int argc, char** argv) {
  int n;
  memset(res, 0, sizeof res);
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    res[x]++;
  }
  for (int i = 0; i < 1000110; i++) {
    res[i + 1] += res[i] / 2;
    res[i] &= 1;
  }
  int con = 0;
  for (int i = 0; i < 1000110; i++) con += res[i];
  printf("%d\n", con);
  return 0;
}
