#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 111;
int n, a[N], m[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int maxi = -1;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    m[a[i]]++;
    maxi = max(maxi, a[i]);
  }
  int ans = 0;
  for (int i = 0; i <= N; i++)
    if (m[i]) {
      int k = m[i] / 2;
      m[i + 1] += k;
      m[i] %= 2;
      ans += m[i];
    }
  cout << ans;
  return 0;
}
