#include <bits/stdc++.h>
using namespace std;
# include <stdio.h>
# include <math.h>
int main()
{
int ans=0;
int n;
scanf("%d",&n);
int temp;
map<int,int>arr;
for(int i=0;i<n;i++)
{scanf("%d",&temp);
arr[temp]++;
}
map<int,int>::iterator it=arr.begin();
while(it!=arr.end())
{ // it=arr.begin();
int val=it->second;
int key=it->first;
if(val%2==0)
{ int k=val/2;
it->second=it->second-val;
arr[1+key]+=k;
}
else { it->second=it->second-1;
ans=ans+1; }
if(it->second<=0)
it++;
}
cout<<ans<<endl;
}
CiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojIGluY2x1ZGUgPHN0ZGlvLmg+CiMgaW5jbHVkZSA8bWF0aC5oPgoKaW50IG1haW4oKQp7CgppbnQgYW5zPTA7CmludCBuOwogIHNjYW5mKCIlZCIsJm4pOwogIGludCB0ZW1wOwptYXA8aW50LGludD5hcnI7CmZvcihpbnQgaT0wO2k8bjtpKyspCiAge3NjYW5mKCIlZCIsJnRlbXApOwogICAgICBhcnJbdGVtcF0rKzsKICB9CiBtYXA8aW50LGludD46Oml0ZXJhdG9yIGl0PWFyci5iZWdpbigpOwp3aGlsZShpdCE9YXJyLmVuZCgpKQp7IC8vIGl0PWFyci5iZWdpbigpOwogaW50IHZhbD1pdC0+c2Vjb25kOwogaW50IGtleT1pdC0+Zmlyc3Q7CmlmKHZhbCUyPT0wKQogICAgeyAgaW50IGs9dmFsLzI7CiAgICBpdC0+c2Vjb25kPWl0LT5zZWNvbmQtdmFsOwogICAgICAgIGFyclsxK2tleV0rPWs7CgogICAgICAgfQogIGVsc2UgeyAgaXQtPnNlY29uZD1pdC0+c2Vjb25kLTE7CiAgICAgICAgYW5zPWFucysxOyB9CgoKaWYoaXQtPnNlY29uZDw9MCkKICAgaXQrKzsKfQpjb3V0PDxhbnM8PGVuZGw7Cn0=