#include <bits/stdc++.h>
using namespace std;
long long a[1234570];
int main() {
  long long n, x;
  scanf("%I64d", &n);
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &x);
    a[x]++;
  }
  for (int i = 0; i <= 1000300; ++i) {
    a[i + 1] += (a[i] / 2);
    if (a[i] % 2 == 1) ans++;
  }
  cout << ans;
  return 0;
}
