#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:67108864")
using namespace std;
const int mod = (int)1e9;
const int inf = (int)2e9;
const int base = 1000 * 1000 * 1000;
const int maxn = (int)5e6 + 10;
const long double pi = acosl(-1.0);
const long double eps = 1e-9;
void error(void) { exit(1); }
int main() {
  vector<int> a(maxn, 0);
  int n, val;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> val;
    a[val]++;
  }
  int ans = 0;
  for (int i = 0; i < maxn - 1; i++) {
    a[i + 1] += a[i] / 2;
    if (a[i] % 2 == 1) ans++;
  }
  if (a[maxn - 1] != 0) ans++;
  cout << ans;
  return 0;
}
