#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 2;
const long long N = 1e6 + 1;
long long n;
set<int> Q;
int main() {
  scanf("%d", &n);
  int ans = 1;
  Q.clear();
  while (n--) {
    int x;
    scanf("%d", &x);
    set<int>::iterator it = Q.find(x);
    while (it != Q.end()) {
      Q.erase(it);
      x++;
      it = Q.find(x);
    }
    Q.insert(x);
  }
  printf("%d\n", Q.size());
  return 0;
}
