#include <bits/stdc++.h>
int mp[1010000], ans, n, m, x;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    mp[x]++;
  }
  for (int i = 0; i <= 1e6 + 21; i++) {
    if (mp[i] % 2 == 1) ans++;
    mp[i + 1] += mp[i] / 2;
  }
  printf("%d", ans);
}
