#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<unsigned long long int, unsigned long long int>& a,
         pair<unsigned long long int, unsigned long long int>& b) {
  if (a.first == b.first)
    return a.second > b.second;
  else
    return a.first < b.first;
}
bool canmove(unsigned long long int x, unsigned long long int y) {
  if (x < 0 || x >= 2 || y < 0 || y >= 3) return false;
  return true;
}
unsigned long long int arr[3000006] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unsigned long long int n;
  cin >> n;
  for (unsigned long long int i = 0; i < n; i++) {
    unsigned long long int a;
    cin >> a;
    arr[a]++;
  }
  unsigned long long int ans = 0;
  for (unsigned long long int i = 0; i < 3000005; i++) {
    arr[i + 1] += (arr[i] / 2);
    ans += (arr[i] % 2);
  }
  cout << ans << endl;
}
