#include <bits/stdc++.h>
using namespace std;
long long a[1100000] = {0};
int main() {
  long long n, m, k = 0, max = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &m);
    a[m]++;
  }
  for (long long i = 0; i < 1100000; i++) {
    a[i + 1] = a[i + 1] + a[i] / 2;
    a[i] = a[i] % 2;
    k = k + a[i];
  }
  cout << k;
  return 0;
}
