#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int w[1000000 + 100];
  int temp;
  for (int i = 0; i < 1000000 + 100; i++) {
    w[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> temp;
    w[temp]++;
  }
  long long int ans = 0;
  for (int i = 0; i < 1000000 + 100; i++) {
    temp = w[i];
    w[i] = w[i] % 2;
    w[i + 1] += temp / 2;
  }
  for (int i = 0; i < 1000000 + 100; i++) {
    if (w[i]) ans += w[i];
  }
  cout << ans << endl;
}
