#include <bits/stdc++.h>
const long long int N = 2e6;
using namespace std;
int binaryexp(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return binaryexp(x * x, n / 2);
  else
    return x * binaryexp(x * x, (n - 1) / 2);
}
int freq[N];
int len = 0, n, N1 = 1001000;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    freq[a[i]]++;
  }
  long long int cnt = 0;
  for (int i = 0; i < N; i++) {
    freq[i + 1] += freq[i] / 2;
    cnt += freq[i] % 2;
  }
  cout << cnt << endl;
}
