#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i, j, k, l, a;
  int visi[1100100] = {0};
  int maxi = -1;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    if (a > maxi) maxi = a;
    visi[a] += 1;
  }
  int ans = 0;
  for (i = 0; i < 1100100; i++) {
    visi[i + 1] += visi[i] / 2;
    visi[i] = visi[i] % 2;
    if (visi[i] != 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
