#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)(1e6) + 30;
int f[MAX_N];
int n;
void input() {
  memset(f, 0, sizeof(f));
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    f[a]++;
  }
}
int work() {
  int ret = 0;
  for (int i = 0; i < MAX_N; i++) {
    f[i + 1] += f[i] / 2;
    f[i] = f[i] % 2;
    if (f[i] == 1) ret++;
  }
  return ret;
}
int main() {
  input();
  printf("%d\n", work());
  return 0;
}
