#include <bits/stdc++.h>
using namespace std;
int a[1001001];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  int s = 0;
  for (int i = 0; i < 1001000; i++) {
    s += a[i] % 2;
    a[i + 1] += a[i] / 2;
  }
  cout << s;
}
