# Approach 1: Bit Manipulation

# Time: O(n), n = no. of bits of the number
# Space: O(1)

class Solution:
    def minFlips(self, a: int, b: int, c: int) -> int:
        answer = 0
        while a or b or c:
            if c & 1:
                answer += 0 if ((a & 1) or (b & 1)) else 1
            else:
                answer += (a & 1) + (b & 1)

            a >>= 1
            b >>= 1
            c >>= 1

        return answer