#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> s;
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i != n; ++i) {
    scanf("%d", &x);
    set<int>::iterator it = s.find(x);
    while (it != s.end()) {
      s.erase(it);
      x++;
      it = s.find(x);
    }
    s.insert(x);
  }
  n = s.size();
  printf("%d\n", n);
  return 0;
}
