```
class Solution:
# @param {integer} n
# @return {boolean}
def isPowerOfTwo(self, n):
if n <= 0:
return False
if n == 1:
return True
while n > 1:
if n%2 == 0:
n = n/2
else:
return False
return True
```