#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 100;
int f[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    f[x]++;
  }
  int cnt = 0;
  for (int i = 0; i < 2000001; i++) {
    cnt += (f[i] & 1);
    f[i + 1] += (f[i] / 2);
  }
  cout << cnt;
  return 0;
}
