#include <bits/stdc++.h>
using namespace std;
int maxn = 1000000 + 100;
int main() {
  int n;
  scanf("%d", &n);
  int arr[maxn + 10];
  int a;
  memset(arr, 0, sizeof(arr));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    arr[a] += 1;
  }
  int answer = 0;
  for (int i = 0; i <= maxn; i++) {
    if (arr[i]) {
      arr[i + 1] += arr[i] / 2;
      arr[i] %= 2;
      if (arr[i]) answer++;
    }
  }
  printf("%d\n", answer);
}
