#include <bits/stdc++.h>
using namespace std;
int read_int() {
  char r;
  bool start = false, neg = false;
  long long int ret = 0;
  while (true) {
    r = getchar();
    if ((r - '0' < 0 || r - '0' > 9) && r != '-' && !start) {
      continue;
    }
    if ((r - '0' < 0 || r - '0' > 9) && r != '-' && start) {
      break;
    }
    if (start) ret *= 10;
    start = true;
    if (r == '-')
      neg = true;
    else
      ret += r - '0';
  }
  if (!neg)
    return ret;
  else
    return -ret;
}
int dx[] = {1, -1, 0, 0, -1, -1, +1, 1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
int horsex[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int horsey[] = {1, -1, -2, -2, -1, 1, 2, 2};
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long int powmod(long long int a, long long int n, long long int MOD) {
  long long int p = 1;
  for (; n;) {
    if (n % 2) p = (p)*a % MOD;
    if (n /= 2) a = (a)*a % MOD;
  }
  return p;
}
long long int power(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  }
  long long int temp = power(a, b / 2);
  long long int val = (temp * temp);
  if (b & 1) {
    return (a * temp);
  } else {
    return val;
  }
}
long long int invmod(long long int a, long long int m) {
  long long int ans = powmod(a, m - 2, m);
  return ans;
}
bool ispalin(char str[]) {
  bool f = 1;
  int l = strlen(str);
  for (int i = 0; i <= (l - 1) / 2; i++) {
    if (str[i] != str[l - i - 1]) return 0;
  }
  return 1;
}
long long int rev(long long int num) {
  long long int ans = 0;
  while (num != 0) {
    int rem = num % 10;
    num = num / 10;
    ans = ans * 10 + rem;
  }
  return ans;
}
long long int sum(long long int a, long long int r, long long int term) {
  long long int ans = powmod(r, term, 1000000007);
  long long int res1 = (ans - 1) % 1000000007;
  res1 = (a * res1) % 1000000007;
  return res1;
}
int arr[1000010];
int ans = 0;
int main() {
  multiset<int> a, b;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    arr[i] = read_int();
    a.insert(arr[i]);
  }
  multiset<int>::iterator it;
  multiset<int>::iterator it2;
  while (!a.empty()) {
    it = a.begin();
    it2 = b.find(*it);
    if (it2 != b.end()) {
      b.erase(it2);
      int val = *it + 1;
      b.insert(val);
      a.erase(it);
    } else {
      b.insert(*it);
      a.erase(it);
    }
  }
  while (!b.empty()) {
    it = b.begin();
    int val = *it;
    b.erase(it);
    it2 = b.find(val);
    if (it2 != b.end()) {
      b.erase(it2);
      b.insert(val + 1);
    } else {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
