#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000000000000000LL;
const int MAXN = 1000005;
int n;
int a[MAXN];
int main(void) {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", a + i);
  sort(a, a + n);
  deque<int> dq;
  for (int i = n - 1; i >= 0; --i) {
    dq.push_front(a[i]);
    while (dq.size() >= 2 && dq[0] == dq[1]) {
      int v = dq[0];
      dq.pop_front();
      dq.pop_front();
      dq.push_front(v + 1);
    }
  }
  printf("%d\n", (int)dq.size());
  return 0;
}
