```
class Solution {
public:
bool isPowerOfTwo(int n) {
int count=0;
if(n<=0)
{
return false;
}
for(int i=0;i<sizeof(n)*8;i++)
{
if((n>>i) & (unsigned int)(0x01))
{
count++;
}
if(count>1){
return false;
}
}
}
};
```