#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1000000000;
const long long int_ll = 100000000000000000;
void prin(vector<int>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << " ";
  }
}
void prin_new_line(vector<int>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << "\n";
  }
}
void prin(vector<long long>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << " ";
  }
}
void prin_new_line(vector<long long>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << "\n";
  }
}
int sum_vec(vector<int>& a) {
  int s = 0;
  for (int i = 0; i < a.size(); i++) {
    s += a[i];
  }
  return s;
}
int min(int a, int b, int c) { return min(a, min(b, c)); }
long long min(long long a, long long b, long long c) {
  return min(a, min(b, c));
}
int max(int a, int b, int c) { return max(a, max(b, c)); }
long long max(long long a, long long b, long long c) {
  return max(a, max(b, c));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(1000005, 0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  int ans = 0;
  int x = 0;
  for (int i = 0; i < 1000030; i++) {
    x += a[i];
    if (x % 2 == 1) {
      ans++;
      x--;
    }
    x = x / 2;
  }
  cout << ans;
}
