#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p) {
  if (p == 0) return 1;
  long long my = bigmod(b, p / 2);
  my *= my;
  my %= 1000000007;
  if (p & 1) my *= b, my %= 1000000007;
  return my;
}
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
struct info {
  long long x;
  bool operator<(const info& p) const { return x > p.x; }
};
priority_queue<info> pq;
int main() {
  long long n, i, x;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &x);
    info tmp;
    tmp.x = x;
    pq.push(tmp);
  }
  long long tot = 0;
  while (pq.empty() == 0) {
    info f = pq.top(), s;
    pq.pop();
    if (pq.empty() == 0) {
      s = pq.top();
      pq.pop();
    } else {
      tot++;
      break;
    }
    if (f.x == s.x) {
      info tmp;
      tmp.x = f.x + 1;
      pq.push(tmp);
    } else {
      tot++;
      pq.push(s);
    }
  }
  printf("%lld", tot);
  printf("\n");
  return 0;
}
