#include <iostream>
using namespace std;
const int MAX = 1000100;
int a[MAX];
int main()
{
ios::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
a[x]++;
}
int ans = 0;
for (int i = 0; i < MAX - 1; i++)
{
a[i + 1] += a[i] / 2;
a[i] %= 2;
ans += a[i];
}
cout << ans << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTUFYID0gMTAwMDEwMDsKaW50IGFbTUFYXTsKaW50IG1haW4oKQp7Cglpb3M6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CglpbnQgbjsKCWNpbiA+PiBuOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspCgl7CgkJaW50IHg7CgkJY2luID4+IHg7CgkJYVt4XSsrOwoJfQoJaW50IGFucyA9IDA7Cglmb3IgKGludCBpID0gMDsgaSA8IE1BWCAtIDE7IGkrKykKCXsKCQlhW2kgKyAxXSArPSBhW2ldIC8gMjsKCQlhW2ldICU9IDI7CgkJYW5zICs9IGFbaV07Cgl9Cgljb3V0IDw8IGFucyA8PCBlbmRsOwoJcmV0dXJuIDA7Cn0K