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