#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int SIZE = 1000020;
int n;
int main() {
  int x;
  while (scanf("%d", &n) != EOF) {
    priority_queue<int, vector<int>, greater<int> > q;
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      q.push(x);
    }
    int sum = 0;
    while (!q.empty()) {
      int t1 = q.top();
      q.pop();
      if (q.empty()) {
        sum++;
        break;
      }
      int t2 = q.top();
      q.pop();
      if (q.empty()) {
        if (t1 == t2) {
          sum++;
          break;
        } else {
          sum += 2;
          break;
        }
      } else {
        if (t1 == t2) {
          q.push(t2 + 1);
        } else {
          sum++;
          q.push(t2);
        }
      }
    }
    printf("%d\n", sum);
  }
}
