#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int mod = 1000000007;
const double pi = (double)22 / 7;
int u[3000000 + 2];
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    u[x]++;
  }
  for (int i = 0; i <= 3 * 1e6; i++) {
    u[i + 1] += u[i] / 2;
    u[i] %= 2;
  }
  long long ans = 0;
  for (int i = 0; i <= 3 * 1e6 + 1; i++) ans += u[i];
  cout << ans << '\n';
}
