class Solution {
public:
bool isPowerOfTwo(int n) {
int count =0;
if(n<0)
{
return 0;
}
while(n)
{
n&=n-1;
count = count +1;
}
if(count ==1){
return 1;
}
else{
return 0;
}
}
};