#include <bits/stdc++.h>
using namespace std;
int n, w[1000999];
int arr[1009999];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
    arr[w[i]]++;
  }
  for (int i = 0; i < 1000099; i++) {
    arr[i + 1] += arr[i] / 2;
    arr[i] = arr[i] % 2;
  }
  int ans = 0;
  for (int i = 0; i < 1000099; i++) {
    if (arr[i] >= 1) {
      ans++;
    }
  }
  cout << ans << endl;
}
