#include <bits/stdc++.h>
using namespace std;
int n;
long long A[2000001];
int main() {
  cin >> n;
  for (int p, i = 1; i <= n; i++) {
    scanf("%d", &p);
    A[p]++;
  }
  long long ans = 0;
  for (int i = 0; i <= 1000050; i++) {
    ans += (A[i] & 1);
    A[i + 1] += A[i] / 2;
  }
  cout << ans << endl;
}
