#include <bits/stdc++.h>
using namespace std;
int cnt[1100000], a[1100000];
int n;
int main() {
  scanf("%d", &n);
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    cnt[x]++;
  }
  int f = 1;
  a[0] = 1;
  for (int i = 1; (1 << i) < n; i++) {
    a[(1 << i)] = i;
  }
  for (int i = 1; i <= n; i++) a[i] = max(a[i], a[i - 1]);
  int ans = 0;
  for (int i = 0; i < 1000055; i++) {
    int val = cnt[i];
    while (val > 1) {
      int x = a[val];
      cnt[x + i]++;
      cnt[i] -= (1 << x);
      val -= (1 << x);
    }
    if (val) ans++;
  }
  cout << ans << endl;
}
