Count set bits from hackerblocks

#include
using namespace std;
int main() {
int n;
while(n–)
{
int a;
cin>>a;
int cnt=0;
while(a>0)
{
int l=(a&1);
if(l==1)
{
cnt++;
}
a=a>>1;
}
cout<<cnt<<endl;
}
return 0;
}

THE CODE IS NOT RIGHT…WHAT IS THE MISTAKE?

add cin>>n before while