#include <bits/stdc++.h>
const int N = 1000500;
using namespace std;
int vis[N];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < n; i++) {
      int x;
      scanf("%d", &x);
      vis[x]++;
    }
    for (int i = 0; i < 1000400; i++) {
      vis[i + 1] += vis[i] / 2;
      vis[i] %= 2;
    }
    int sum = 0;
    for (int i = 0; i < 1000400; i++) sum += vis[i];
    printf("%d\n", sum);
  }
  return 0;
}
