#include <bits/stdc++.h>
using namespace std;
int n, a, b[2000000], ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    b[a]++;
  }
  ans = 0;
  for (int i = 0; i < 2000000; i++) {
    b[i + 1] = b[i + 1] + b[i] / 2;
    ans = ans + b[i] % 2;
  }
  cout << ans;
  return 0;
}
