#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a;
  int sum[2000110], ans = 0;
  for (int i = 0; i < 2000100; i++) sum[i] = 0;
  while (a--) {
    scanf("%d", &b);
    sum[b]++;
  }
  for (int i = 0; i < 2000100; i++) {
    if ((sum[i] % 2)) ans++;
    sum[i + 1] += sum[i] / 2;
  }
  printf("%d", ans);
}
