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