#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin.sync_with_stdio(false);     cout.sync_with_stdio(false);     cin >> n;     vector<long long> q(1000100, 0);     for (long long i = 0; i < n; i++) {       long long t;       cin >> t;       q[t]++;     }     long long ans = 0;     for (long long i = 0; (i < 1000100 - 1); ++i) {       if (q[i] % 2 == 1) ans++;       q[i + 1] += q[i] / 2;     }     cout << ans;     return 0;   }   