#include <bits/stdc++.h>
using namespace std;
class mycomparison {
  bool reverse;

 public:
  mycomparison(const bool& revparam = false) { reverse = revparam; }
  bool operator()(const int& lhs, const int& rhs) const {
    if (reverse)
      return (lhs < rhs);
    else
      return (lhs > rhs);
  }
};
int main() {
  priority_queue<int, vector<int>, mycomparison> myqueue;
  int numberOfElement, count;
  cin >> numberOfElement;
  for (int j = 0; j < numberOfElement; j++) {
    int x;
    scanf("%d", &x);
    myqueue.push(x);
  }
  count = 0;
  while (!myqueue.empty()) {
    if (myqueue.size() == 1) {
      count++;
      myqueue.pop();
    } else {
      int temp1, temp2;
      temp1 = myqueue.top();
      myqueue.pop();
      temp2 = myqueue.top();
      myqueue.pop();
      if (temp1 == temp2) {
        temp1++;
        myqueue.push(temp1);
      } else if (temp1 != temp2) {
        count++;
        myqueue.push(temp2);
      }
    }
  }
  cout << count << endl;
  return 0;
}
