#include <bits/stdc++.h>
using namespace std;
int n, t, x[1100000], ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    x[t]++;
  }
  for (int i = 0; i < 1099999; i++) {
    x[i + 1] += x[i] / 2;
    x[i] = x[i] % 2;
  }
  for (int i = 0; i < 1099999; i++) {
    if (x[i]) ans++;
  }
  printf("%d", ans);
  return 0;
}
