#include <bits/stdc++.h>
using namespace std;
int n, Ans;
int w[1000050], num[1000050];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    w[i] = read();
    num[w[i]]++;
  }
  for (int i = 0; i < 1000050; i++) {
    if (num[i] > 0) {
      int t = num[i] / 2;
      num[i + 1] += t;
      if (num[i] % 2 == 1) Ans++;
    }
  }
  cout << Ans << endl;
  return 0;
}
