#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000030;
int a[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n, x, ans = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    a[x]++;
  }
  for (int i = 0; i < maxn - 1; ++i) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}
