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