/* package whatever; // don't place package name! */
import java.util.* ;
import java.lang.* ;
import java.io.* ;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main
( String [ ] Args
) {
Scanner sc
= new Scanner
( System .
in ) ; int n = sc.nextInt ( ) ;
int [ ] w = new int [ n] ;
int [ ] b
= new int [ 1000000 + ( int ) Math .
log ( 1000000 ) ] ;
for ( int i= 0 ; i< n; i++ )
{
w[ i] = sc.nextInt ( ) ;
b[ w[ i] ] ++;
}
int ans= 0 ;
for ( int i = 0 ; i< b.length - 1 ; i++ )
{
if ( b[ i] > 0 ) {
b[ i+ 1 ] += b[ i] / 2 ;
b[ i] = b[ i] % 2;
ans+= b[ i] ;
}
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmcgW10gQXJncykKICAgIHsKICAgICAgICBTY2FubmVyIHNjID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKICAgICAgICBpbnQgbiA9IHNjLm5leHRJbnQoKTsKICAgICAgICBpbnQgW10gdyAgPSBuZXcgaW50W25dOwogICAgICAgIGludCBbXSBiID0gbmV3IGludFsxMDAwMDAwKyhpbnQpTWF0aC5sb2coMTAwMDAwMCldOwoKICAgICAgICBmb3IgKGludCBpPTA7IGk8bjsgaSsrKQogICAgICAgIHsKICAgICAgICAgICAgd1tpXT1zYy5uZXh0SW50KCk7CiAgICAgICAgICAgIGJbd1tpXV0rKzsKICAgICAgICB9CgogICAgICAgIGludCBhbnM9MDsKICAgICAgICBmb3IgKGludCBpID0gMDsgaTxiLmxlbmd0aC0xOyBpKyspCiAgICAgICAgewogICAgICAgICAgICBpZiAoYltpXT4wKXsKICAgICAgICAgICAgYltpKzFdKz1iW2ldLzI7CiAgICAgICAgICAgIGJbaV09YltpXSUyOwogICAgICAgICAgICBhbnMrPWJbaV07CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIFN5c3RlbS5vdXQucHJpbnQoYW5zKTsKICAgIH0KfQ==