```
class Solution:
# @param {integer} m
# @param {integer} n
# @return {integer}
def rangeBitwiseAnd(self, m, n):
if m == n: return m
if m <= 1 or n <= 1: return 0
powerM = 1
while m/powerM > 1:
powerM *= 2
powerN = 1
while n/powerN > 1:
powerN *= 2
if powerM != powerN:
return 0
else:
return powerM + self.rangeBitwiseAnd(m-powerM, n-powerN)
```