```
class Solution:
# @param {integer} n
# @return {boolean}
def isPowerOfTwo(self, n):
if n == 1 or n == 2:
return True
for i in xrange(2, n // 2 + 1):
if n % i != 0:
break
temp = n * 1.00
while temp >= 1:
temp /= i
if temp == 1:
return True
return False
```