#include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<pair<int, int> > v2;
int main() {
  int n;
  scanf(" %d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf(" %d", &a);
    v.push_back(a);
  }
  sort(v.rbegin(), v.rend());
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cnt++;
    if (i == n - 1 || v[i + 1] != v[i]) {
      v2.push_back(make_pair(cnt, v[i]));
      cnt = 0;
    }
  }
  int ans = 0;
  while (!v2.empty()) {
    int qnt = v2.back().first;
    int val = v2.back().second;
    v2.pop_back();
    if (qnt % 2) ans++;
    if (qnt >= 2) {
      if (!v2.empty() && v2.back().second == val + 1)
        v2.back().first += qnt / 2;
      else
        v2.push_back(make_pair(qnt / 2, val + 1));
    }
  }
  printf("%d\n", ans);
  return 0;
}
