#include <bits/stdc++.h>
using namespace std;
int prost[1000030];
int pow2[21];
int main() {
  bool b = 1;
  int a = 1, n, max = 0;
  long long ans = 0;
  for (int i = 0; i < 21; ++i) {
    pow2[i] = a;
    a *= 2;
  }
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    ++prost[a];
    if (max < a) max = a;
  }
  for (int i = 0; i <= 1000029; ++i) {
    a = prost[i] / 2;
    prost[i] -= a * 2;
    if (prost[i]) ++ans;
    prost[i + 1] += a;
  }
  printf("%I64d", ans);
  return 0;
}
