#include <bits/stdc++.h>
using namespace std;
int mp[1010000], ans;
int main() {
  int n, m, x;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    mp[x]++;
  }
  for (int i = 0; i <= 1e6 + 21; i++) {
    int num = i;
    int numcnt = mp[i];
    if (numcnt % 2 == 1) ans++;
    mp[num + 1] += numcnt / 2;
  }
  cout << ans;
}
