How would you implement a bitwise function to count the number of set bits in a 32-bit integer? Implement count_set_bits(n), which accepts an unsigned 32-bit integer and returns the number of 1 bits in its binary representation. Use bitwise operations rather than converting the value to a string or using a library bit-counting function.
def count_set_bits(n):