#include <bits/stdc++.h>
using namespace std;
int a[2000005] = {0};
int main() {
  int n;
  scanf("%d", &n);
  int tmp;
  for (int i = 0; i < n; i++) {
    scanf("%d", &tmp);
    a[tmp]++;
  }
  for (int i = 0; i <= 2000000; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
  }
  int ans = 0;
  for (int i = 0; i <= 2000001; i++) ans += a[i];
  cout << ans << endl;
}
