#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  scanf("%ld", &n);
  long int count = 0;
  int *arr;
  arr = new int[1100000];
  for (long int i = 0; i < n; i++) {
    long int w;
    scanf("%ld", &w);
    arr[w]++;
  }
  for (long int i = 0; i < 1099999; i++) {
    arr[i + 1] += arr[i] / 2;
    arr[i] %= 2;
    if (arr[i] == 1) count++;
  }
  printf("%ld", count);
  return 0;
}
