#include <bits/stdc++.h>
using namespace std;
string toYesNo(bool b) { return b ? "YES" : "NO"; }
class Scanner {
  std::istream &in;

 public:
  Scanner(std::istream &in) : in(in) {}
  template <class T>
  void read(T &result) {
    in >> result;
  }
};
class Writer {
  std::ostream &out;

 public:
  Writer(std::ostream &out) : out(out) {}
  template <class T>
  void write(T value) {
    out << value;
  }
};
int a[2000000];
class TaskA {
 public:
  void solve(std::istream &inStream, std::ostream &outStream) {
    Scanner in(inStream);
    Writer out(outStream);
    int n;
    in.read(n);
    memset(a, 0, sizeof(a));
    for (auto i = 0; i < n; ++i) {
      int w;
      in.read(w);
      a[w]++;
    }
    int cnt = 0;
    for (auto i = 0; i < 2000000; ++i) {
      if (a[i] > 0) {
        a[i + 1] += a[i] / 2;
        a[i] %= 2;
        if (a[i] > 0) {
          ++cnt;
        }
      }
    }
    out.write(cnt);
  }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  TaskA solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
