#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int MAXX = 2e6;
int a[MAXX];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  int ans = 0;
  for (int i = 0; i < MAXX - 1; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}
