#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int N = 3e6 + 7;
const int INF = 1e9 + 9;
const int xi[] = {0, 0, +1, -1};
const int yi[] = {-1, +1, 0, 0};
const int xxi[] = {-1, +1, 0, 0, -1, +1, +1, -1};
const int yyi[] = {0, 0, -1, +1, -1, +1, -1, +1};
int n, ans;
int w[1000001], cnt[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    cnt[w[i]]++;
  }
  for (int i = 0; i <= N - 1; i++) {
    cnt[i + 1] += cnt[i] / 2;
    cnt[i] %= 2;
    ans += cnt[i];
  }
  cout << ans;
}
