#include <bits/stdc++.h>
using namespace std;
const unsigned long long int MAX = 1e7, inf = 1e15 + 1, N = 2000;
unsigned long long int n, ans, a[MAX], b[MAX];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (unsigned long long int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  for (unsigned long long int i = 0; i <= MAX; i++) {
    b[i + 1] += (i[b] / 2);
    b[i] %= 2;
    if (b[i]) {
      ans++;
    }
  }
  return cout << ans << "\n", 0;
}
