#include <bits/stdc++.h>
int main() {
  std::size_t n;
  std::cin >> n;
  std::map<std::size_t, std::size_t> power_counter;
  for (std::size_t i = 0; i < n; ++i) {
    int x;
    std::scanf("%d", &x);
    ++power_counter[x];
  }
  auto it = power_counter.begin();
  while (it != power_counter.end()) {
    auto curr_power = it->first;
    auto number_of_new_pairs = it->second / 2;
    if (number_of_new_pairs > 0) {
      power_counter[curr_power] -= number_of_new_pairs * 2;
      power_counter[curr_power + 1] += number_of_new_pairs;
    }
    it = power_counter.upper_bound(curr_power);
  }
  auto non_zero_powers = 0;
  for (const auto& v : power_counter) {
    if (v.second != 0) {
      ++non_zero_powers;
    }
  }
  std::cout << non_zero_powers << std::endl;
  return 0;
}
