#include <bits/stdc++.h>
using namespace std;
long long int n, ans[2000010];
int main() {
  scanf("%lld", &n);
  long long int temp;
  for (long long int i = 0; i < n; ++i) {
    scanf("%lld", &temp);
    ans[temp]++;
  }
  long long int res = 0;
  for (long long int i = 0; i <= 2000007; ++i) {
    if (!ans[i]) continue;
    ans[i + 1] += ans[i] / 2;
    ans[i] %= 2;
    res += ans[i];
  }
  printf("%lld\n", res);
  return 0;
}
