#include <bits/stdc++.h>
using namespace std;
const int NN = 1005;
struct W {
  int a;
  bool operator<(const W &I) const { return I.a < a; }
};
struct W w[1000005];
int main() {
  int n, num;
  scanf("%d", &n);
  priority_queue<W> Q;
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i].a);
    Q.push(w[i]);
  }
  num = 0;
  while (1) {
    if (Q.size() == 0) {
      break;
    } else if (Q.size() == 1) {
      num++;
      break;
    } else {
      int p, q;
      p = Q.top().a;
      Q.pop();
      q = Q.top().a;
      W neww;
      if (p == q) {
        neww.a = p + 1;
        Q.push(neww);
        Q.pop();
      } else {
        num++;
      }
    }
  }
  printf("%d\n", num);
  return 0;
}
