#include <bits/stdc++.h>
using namespace std;
unsigned long long arr[10000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  unsigned long long n, ans = 0, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr[x]++;
  }
  for (int i = 0; i <= 10000000; i++) {
    if (arr[i] % 2 == 0) {
      arr[i + 1] += arr[i] / 2;
      arr[i] = 0;
    } else {
      arr[i + 1] += arr[i] / 2;
      arr[i] = 1;
    }
  }
  for (int i = 0; i <= 3000000; i++) {
    ans += arr[i];
  }
  cout << ans << endl;
  return 0;
}
