#include <bits/stdc++.h>
using namespace std;
long long fast_power(long long base, long long power) {
  if (power == 0) return 1;
  long long temp = fast_power(base, (power / 2));
  temp = (temp * temp) % 1000000007;
  if (power % 2 != 0) temp = (temp * base) % 1000000007;
  return temp % 1000000007;
}
long long arr[2000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr[x]++;
  }
  long long res = 0;
  for (int i = 0; i < 2000005; i++) {
    arr[i + 1] += arr[i] / 2;
    res += (arr[i] & 1);
  }
  cout << res << endl;
  return 0;
}
