#include <bits/stdc++.h>
using namespace std;
int a[1000111], n, x;
int main() {
  scanf("%d", &n);
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  for (int i = 0; i < 1000100; i++) {
    a[i + 1] += a[i] / 2;
    a[i] %= 2;
  }
  int ans = 0;
  for (int i = 0; i <= 1000100; i++) ans += a[i];
  cout << ans << endl;
}
