#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
inline long long int power(long long int x, long long int y) {
  long long int ans = 1;
  while (y > 0) {
    if (y & 1) ans = (ans * x) % 1000000007;
    x = (x * x) % 1000000007;
    y /= 2;
  }
  return ans;
}
inline int read() {
  int ret = 0;
  int c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    ret = (ret << 3) + (ret << 1) + c - '0';
    c = getchar();
  }
  return ret;
}
int cnt[1100005];
int main() {
  int n;
  scanf("%d", &n);
  int x;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    cnt[x]++;
  }
  int ans = 0;
  for (int i = 0; i < 1100005; i++) {
    ans += (cnt[i] % 2);
    cnt[i + 1] += cnt[i] / 2;
  }
  printf("%d\n", ans);
  return 0;
}
