#include <bits/stdc++.h>
using namespace std;
int counter = 0, freq[6000000], i, n, var, x, y;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> var;
    freq[var]++;
  }
  int max1 = 1000000;
  for (i = 0; i <= max1; i++) {
    x = freq[i];
    y = x;
    if (x != 1) freq[i] = 0;
    counter = 0;
    while (y != 0) {
      if (y % 2) {
        freq[i + counter]++;
        max1 = max(max1, counter + i);
      }
      y = y / 2;
      counter++;
    }
  }
  counter = 0;
  for (i = 0; i <= max1; i++)
    if (freq[i] != 0) counter++;
  cout << counter << "\n";
  return 0;
}
