#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e6;
int a[2 * MAX_N + 5];
int N;
int main() {
  scanf("%d\n", &N);
  for (int i = 1; i <= N; i++) {
    int w;
    scanf("%d", &w);
    a[w]++;
  }
  int x = 0;
  for (int i = 0; i <= MAX_N + 50; i++) {
    while (a[i] >= 2) {
      a[i + 1]++;
      a[i] -= 2;
    }
    if (a[i] == 1) {
      x++;
    }
  }
  printf("%d\n", x);
  return 0;
}
