You will be given a list of 32 bit unsigned integers. Flip all the bits ($1\rightarrow0$ and $\textbf{0}\rightarrow1$) and return the result as an unsigned integer.  

Example 

$n=9_{10}$   

$\textbf{9}_{10}=1\textbf{001}_{2}$.  We're working with 32 bits, so:  

$00000000000000000000000000001001_2=9_{10}$ 

$11111111111111111111111111110110_2=4294967286_{10}$  

Return $4294967286$.

Function Description

Complete the flippingBits function in the editor below.  

flippingBits has the following parameter(s):

int n: an integer   

Returns   

int: the unsigned decimal integer result

Input Format

The first line of the input contains $\textit{q}$, the number of queries. 

Each of the next $\textit{q}$ lines contain an integer, $n$, to process.  

Constraints

$1\leq q\leq100$ 

$0\leq n<2^{32}$

Sample Input 0
3
2147483647
1
0

Sample Output 0
2147483648
4294967294
4294967295

Explanation 0

$01111111111111111111111111111111_{2}=2147483647_{10}$ 

$10000000000000000000000000000000_2=2147483648_{10}$  

$00000000000000000000000000000001_2=1_{10}$ 

$11111111111111111111111111111110_2=4294967294_{10}$  

$00000000000000000000000000000000_{2}=0_{10}$ 

$11111111111111111111111111111111_2=4294967295_{10}$  

Sample Input 1
2
4
123456

Sample Output 1
4294967291
4294843839

Explanation 1

$00000000000000000000000000000100_{2}=4_{10}$ 

$11111111111111111111111111111011_2=4294967291_{10}$  

$000000000000000111001001000000_2=123456_{10}$ 

$11111111111111100001110110111111_{2}=4294843839_{10}$  

Sample Input 2
3
0
802743475
35601423

Sample Output 2
4294967295
3492223820
4259365872

Explanation 2

$00000000000000000000000000000000_{2}=0_{10}$ 

$11111111111111111111111111111111_2=4294967295_{10}$  

$00101111110110001110010010110011_2=802743475_{10}$ 

$11010000001001110001101101001100_2=3492223820_{10}$  

$00000010000111110011110000001111_2=35601423_{10}$ 

$11111101111000001100001111110000_2=425965872_{10}$

Difficulty: EASY

Solutions:
T = int(input())
for _ in range(T):
	N = int(input())
	print(4294967295 & ~N)


n = int(input())
while n > 0:
	n -= 1
	number = int(input())
	for i in range(0, 32):
		number = number ^ 1 << i
	print(number)


n_cases = int(input())
for _ in range(n_cases):
	x = int(input())
	y = ~x + (1 << 32)
	print(y)


t = int(input())
v = 2 ** 32 - 1
for _ in range(t):
	n = int(input())
	print(v ^ n)


import sys
t = int(sys.stdin.readline().strip())
for tests in range(t):
	n = int(sys.stdin.readline().strip())
	s = ['0' for x in range(32)]
	s_n = '{0:b}'.format(n)
	for x in range(len(s_n)):
		s[31 - x] = s_n[len(s_n) - 1 - x]
	for x in range(32):
		if s[x] == '0':
			s[x] = '1'
		else:
			s[x] = '0'
	print(int(''.join(s), 2))


from re import *
t = int(input())
for i in range(0, t):
	x = int(input())
	b = bin(x)[2:]
	if len(b) != 32:
		b = (32 - len(b)) * '0' + b
	z = 0
	for r in range(0, len(b)):
		if b[r] == '0':
			z += 2 ** (len(b) - r - 1)
	print(z)


def conv(s):
	c = ''
	for x in s:
		if x == '0':
			c += '1'
		else:
			c += '0'
	return int(c, 2)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = '{0:032b}'.format(n)
		print(conv(a))
main()


for t in range(int(input())):
	n = int(input())
	x = 2 ** 32 - 1
	print(n ^ x)


def flip(strn):
	return ''.join(('1' if x == '0' else '0' for x in strn))
t = int(input())
while t > 0:
	t -= 1
	strn = bin(int(input()))[2:].zfill(32)
	strn1 = flip(strn)
	print(int(strn1, 2))


t = int(input())
for i in range(t):
	num = int(input())
	binary = bin(num)
	str(binary)
	binary = binary[2:]
	answer = (32 - len(binary)) * '0' + binary
	ans = ''
	for x in range(len(answer)):
		if answer[x] == '1':
			ans = ans + '0'
		else:
			ans = ans + '1'
	print(int(ans, 2))


def int2bin(n):
	bnum1 = bin(n)
	nb = len(bnum1[2:])
	bnum2 = '0b' + (32 - nb) * '0' + bnum1[2:]
	return bnum2

def bin2int(s1):
	s2 = s1[2:]
	d = 1
	n = 0
	for i in range(32):
		n = n + int(s2[31 - i]) * d
		d = 2 * d
	return n

def flipBits(s1):
	s2 = ''
	for c in s1:
		if c == '0':
			s2 = s2 + '1'
		else:
			s2 = s2 + '0'
	return s2
nn = int(input())
lst = []
for i in range(nn):
	n1 = int(input())
	lst.append(n1)
for i in lst:
	s1 = int2bin(i)
	s2 = flipBits(s1)
	print(bin2int(s2))


for t in range(int(input())):
	n = int(input())
	bits = ['0' if n & 1 << x else '1' for x in range(31, -1, -1)]
	ans = int(''.join(bits), 2)
	print(ans)


import sys
TRANSLATION = str.maketrans('01', '10')
ncases = int(sys.stdin.readline())
for _ in range(ncases):
	n = int(sys.stdin.readline())
	binary = format(n, '#034b')[2:]
	flipped = binary.translate(TRANSLATION)
	print(int(flipped, 2))


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


import ctypes
n = int(input())
for x in range(n):
	num = int(input())
	print(ctypes.c_uint32(~num).value)


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


t = int(input())
for i in range(t):
	n = int(input())
	f = 4294967295
	print(~n & f)


lim = 2 ** 32
n = int(input())
for _ in range(n):
	num = int(input())
	print(lim - num - 1)


T = int(input())
for i in range(T):
	n = int(input())
	print(int(''.join((str(j) for j in [1 for x in range(32 - len(bin(n)[2:]))] + [int(not int(x)) for x in bin(n)[2:]])), 2))


def make_binary(num):
	binary_num = ''
	for i in range(32)[::-1]:
		if num % 2 ** i != num:
			binary_num += '1'
			num -= 2 ** i
		else:
			binary_num += '0'
	return binary_num

def flip_bits(bits):
	flipped_bits = ''
	for i in bits:
		if i == '1':
			flipped_bits += '0'
		else:
			flipped_bits += '1'
	return flipped_bits

def from_binary(num):
	regular_num = 0
	for (i, j) in enumerate(num[::-1]):
		if j == '1':
			regular_num += 2 ** i
	return str(regular_num)
x = int(input())
for i in range(x):
	numb = int(input())
	bits = make_binary(numb)
	flipped_bits = flip_bits(bits)
	flipped_numb = from_binary(flipped_bits)
	print(flipped_numb)


def flip(val):
	MAXINT = 4294967296
	print(MAXINT + ~val)
T = int(input())
for i in range(T):
	val = int(input())
	flip(val)


def myflip(myval):
	mybinval = str(bin(int(myval))[2:])
	myswitch = mybinval.replace('0', '2')
	myswitch = myswitch.replace('1', '0')
	myswitch = myswitch.replace('2', '1')
	myswitch = '11111111111111111111111111111111' + myswitch
	myswitch = myswitch[-32:]
	myint = int(myswitch, 2)
	return myint
import fileinput
for line in fileinput.input():
	if not fileinput.isfirstline():
		flipline = myflip(line)
		print(flipline)


t = int(input())

def flip(intnum):
	fliped = []
	binarynum = bin(intnum)[2:]
	l = 32 - len(binarynum)
	for l in range(l):
		fliped.append(1)
	for b in binarynum:
		if b == '0':
			fliped.append(1)
		else:
			fliped.append(0)
	m = '0b' + ''.join(map(str, fliped))
	print(int(m, 2))
for t in range(t):
	n = int(input())
	flip(n)


import sys

def flipBits(n):
	return ~n + 4294967296
numlines = int(input())
i = 0
while i < numlines:
	print(flipBits(int(input())))
	i = i + 1


from math import pow
nLen = int(input())
for i in range(nLen):
	nCurr = int(input())
	print(str(nCurr ^ int(pow(2, 32) - 1)))


for t in range(int(input())):
	b = str(format(int(input()), '032b'))
	br = '0b' + ''.join(['0' if i == '1' else '1' for i in b])
	print(int(br, 2))


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	print(~N % 2 ** 32)


for k in range(int(input())):
	print(4294967295 - int(input()))


def main():
	cases = int(input())
	for case in range(cases):
		ele = int(input())
		ele = ~ele
		if ele < 0:
			ele += 2 ** 32
		print(ele)
main()


size = int(input())
for index in range(size):
	num = int(input())
	result = -1 + 2 ** 32 ^ num
	print(result)


count = int(input())
if count < 1:
	exit()
for i in range(0, count):
	num = int(input())
	print(~num & 4294967295)


N = int(input())
for i in range(N):
	X = int(input())
	print(4294967295 - X)


l = int(input())
for a in range(l):
	n = int(input())
	ls = []
	while n != 0:
		r = n % 2
		ls.append(r)
		n = n // 2
	while len(ls) < 32:
		ls.append(0)
	i = 0
	while i < len(ls):
		if ls[i] == 0:
			ls[i] = 1
		else:
			ls[i] = 0
		i += 1
	i = 0
	result = 0
	for num in ls:
		result += num * 2 ** i
		i += 1
	print(result)


num_cases = int(input())
test_cases = []
i = 0
while i < num_cases:
	test_cases.append(int(input()))
	i += 1
for case in test_cases:
	print(4294967295 - case)


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


import sys
cases = sys.stdin.read().splitlines()
for i in range(1, len(cases)):
	x = cases[i]
	print(4294967295 - int(x))


t = int(input())
for i in range(t):
	n = int(input())
	print(n ^ 4294967295)


import math, numbers

def bitwiseNot(input):
	return 4294967295 - input
N = input()
i = 0
for x in range(0, int(N)):
	inp = input()
	print(bitwiseNot(int(inp)))


import ctypes
for T in range(int(input())):
	print(ctypes.c_uint32(~int(input())).value)


numberOfTestCases = int(input())
x = 1
while x <= numberOfTestCases:
	x += 1
	testCase = int(input())
	print(~testCase + 2 ** 32)


T = int(input())
for _ in range(T):
	N = int(input())
	s = bin(N)
	flip = 0
	count = len(s) - 2
	org = '0' * (32 - count)
	org = org + s[2:]
	count = 31
	for i in org:
		if i == '1':
			count -= 1
		else:
			flip += 2 ** count
			count -= 1
	print(flip)


nums = int(input())
for i in range(nums):
	n = int(input())
	bits = '{0:b}'.format(n)
	newbits = ''
	for bit in bits:
		if bit == '1':
			newbits += '0'
		else:
			newbits += '1'
	newbits = '1' * (32 - len(newbits)) + newbits
	print(int(newbits, 2))


t = int(input())
for _ in range(t):
	print(int(input()) ^ 4294967295)


cases = int(input())
top = 2 ** 32 - 1
for _ in range(cases):
	n = int(input())
	print(top - n)


allf = 4294967295
t = int(input())
for i in range(t):
	n = int(input())
	print(~n & allf)


A = int(input())
for _ in range(A):
	N = int(input())
	print(4294967295 & ~N)


import re
count = int(input())
for i in range(count):
	num = int(input())
	binary = '{0:032b}'.format(num)
	flipped = re.sub('x', '0', re.sub('0', '1', re.sub('1', 'x', binary)))
	print(int(flipped, 2))


t = int(input())
while t:
	a = int(input())
	print(~a & 4294967295)
	t = t - 1


tests = int(input())
for test in range(tests):
	num = int(input())
	bitNum = bin(num)[2:].zfill(32)
	bitNum = bitNum.replace('0', 'x')
	bitNum = bitNum.replace('1', '0')
	bitNum = bitNum.replace('x', '1')
	print(str(int(bitNum, 2)))


def flip_bit(num):
	flipped = ~num
	return flipped + 4294967296
n = int(input())
num_list = []
for i in range(n):
	num_list.append(int(input()))
for num in num_list:
	print(flip_bit(num))


for _ in range(int(input())):
	(n, m) = (int(input()) & 4294967295, 0)
	for i in range(32):
		m = (m | ~(n & 1 << i) & 1 << i) & 4294967295
	print(m)


for i in range(int(input())):
	n = int(input())
	print(int(~n & 4294967295))


for i in range(int(input())):
	print(~int(input()) & 4294967295)


for x in range(int(input())):
	num = int(input())
	num = 4294967295 - num
	print(num)


def main():
	n = int(input())
	a = []
	for i in range(1, n + 1):
		j = int(input())
		j = ~j + 2 ** 32
		print(j)
main()


t = int(input())
while t > 0:
	t -= 1
	number = int(input())
	i = 0
	while i < 32:
		number = number ^ 1 << i
		i += 1
	print(number)


for _ in range(int(input())):
	print(4294967295 - int(input()))


T = int(input())
for i in range(T):
	num = int(input())
	print(num ^ 4294967295)


def flip(a):
	return 4294967295 - a
n = int(input())
for i in range(0, n):
	num1 = int(input())
	res = flip(num1)
	print(res)


def getAnswer(n):
	x = int(n)
	x = int(4294967296 - x)
	return x - 1

def getInfo():
	t = input()
	while int(t) != 0:
		n = input()
		print(getAnswer(n))
		t = int(t)
		t = t - 1
getInfo()


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


def tobin(num):
	binary = bin(num)[2:].zfill(32)
	return binary

def flip(num):
	flipnum = ''
	for num in str(num):
		if num == '0':
			flipnum += '1'
		if num == '1':
			flipnum += '0'
	return int(flipnum)
cases = int(input(''))
for num in range(0, cases):
	integer = int(input(''))
	binary = tobin(integer)
	flipped = str(flip(binary))
	newint = int(flipped, 2)
	print(newint)


def flipbits(n):
	return 4294967295 - n
ntc = int(input())
for i in range(0, ntc):
	print(flipbits(int(input())))


for _ in range(int(input())):
	print(~int(input()) & 4294967295)


n = int(input())
for i in range(n):
	a = int(input())
	x = list(bin(a)[2:].zfill(32))
	for z in range(len(x)):
		if x[z] == '0':
			x[z] = '1'
		else:
			x[z] = '0'
	print(int(''.join(x), 2))


t = int(input())
for _ in range(t):
	number = list('{:0>32b}'.format(int(input())))
	result = 0
	for index in range(len(number)):
		if number[index] == '1':
			number[index] = '0'
		else:
			number[index] = '1'
	for index in range(32):
		result = result + int(number[index]) * 2 ** (31 - index)
	print(result)


t = int(input())
for c in range(t):
	num = int(input())
	n = 2 ** 32
	n = n - num - 1
	print(n)


getBin = lambda x, n: x >= 0 and bin(x)[2:].zfill(n)
x = input()
newBinStr = ''
for i in range(0, int(x)):
	number = input()
	binStr = getBin(int(number), 32)
	binStr = binStr.replace('0', 'x').replace('1', '0').replace('x', '1')
	print(int(binStr, 2))


import os
import sys
list = [int(x) for x in sys.stdin]
for x in list[1:]:
	print(~x & 4294967295)


tests = int(input())
for x in range(tests):
	num = int(input())
	y = format(num, '032b')
	flip = [0] * 32
	for a in range(len(y)):
		if y[a] == '0':
			flip[a] = '1'
		elif y[a] == '1':
			flip[a] = '0'
		else:
			raise 'Error'
	b = ''.join(flip)
	print(int(b, 2))


def flipBits(bit):
	bit32 = str(bin(bit))[2:]
	bit32 = bit32.zfill(32)
	newbit_arr = []
	for c in bit32:
		if c == '1':
			newbit_arr.append('0')
		else:
			newbit_arr.append('1')
	return int(''.join(newbit_arr), 2)
for t in range(int(input())):
	b = int(input())
	print(flipBits(b))


import math
i = int(input())
for t in range(0, i):
	i = int(input())
	bits = []
	while True:
		(i, r) = divmod(i, 2)
		bits.insert(0, r)
		if i == 0:
			break
	for i in range(0, 32 - len(bits)):
		bits.insert(0, 0)
	bits = [str(abs(x - 1)) for x in bits]
	print(int(''.join(bits), 2))


def getBinary(number):
	binary = bin(number)
	binary = binary[-(len(binary) - 2):]
	for i in range(32 - len(binary)):
		binary = '0' + binary
	return binary

def flipBinary(binary):
	flipped = ''
	for i in binary:
		char = int(i)
		char = 1 - char
		char = str(char)
		flipped += char
	return flipped

def getDecimal(binary):
	decimal = 0
	power = 1
	binary = binary[::-1]
	for i in binary:
		no = int(i)
		decimal += power * no
		power *= 2
	return decimal
import sys
n = int(sys.stdin.readline())
for i in range(n):
	number = int(sys.stdin.readline())
	print(getDecimal(flipBinary(getBinary(number))))


import sys

def flip_bits(el):
	return el ^ 4294967295
for (i, line) in enumerate(sys.stdin):
	if i > 0:
		element = int(line.strip('\n'))
		print(str(flip_bits(element)))


def flipping_bits(x):
	num = list('{0:032b}'.format(x))
	for i in range(len(num)):
		if num[i] == '0':
			num[i] = 1
		else:
			num[i] = 0
	bit_flipped = int(''.join((str(e) for e in num)), 2)
	print(bit_flipped)
T = int(input())
for _ in range(T):
	flipping_bits(int(input()))


T = int(input())
i = 0
while i < T:
	a = int(input())
	a = '{0:032b}'.format(a)
	b = '{0:032b}'.format(4294967295)
	print(int(a, 2) ^ int(b, 2))
	i += 1


import sys
l = []
for line in sys.stdin:
	l.append(int(line.strip()))
for i in range(1, len(l)):
	print(~l[i] & 4294967295)


def to_binary(num):
	binary = bin(num)[2:]
	digits = len(binary)
	if digits < 32:
		extra = 32 - digits
		binary = '0' * extra + binary
	return binary

def flip(binary):
	length = len(binary)
	num = 0
	for i in range(length):
		if int(binary[i]) == 0:
			num += 2 ** (length - 1 - i)
	return num
cases = int(input())
for case in range(cases):
	print(flip(to_binary(int(input()))))


def flip(num):
	return ~num + 2 ** 32
n = int(input())
for _ in range(n):
	num = int(input())
	print(flip(num))


def main():
	mask = (1 << 32) - 1
	n = int(input())
	for i in range(n):
		num = int(input())
		print(num ^ mask)
main()


T = input()
T = int(T)
for x in range(T):
	N = int(input())
	print(~N & 4294967295)


import sys
num_inputs = input()
num_inputs = int(num_inputs)
numList = []
for number in range(0, num_inputs):
	inNum = input()
	numList.append(int(inNum))
refNum = 2 ** 32 - 1
outList = []
for number in numList:
	outNum = refNum - number
	sys.stdout.write(str(outNum))
	sys.stdout.write('\n')


from math import floor

def ConverttoBinary(N):
	A = [0 for i in range(32)]
	i = 31
	while N > 0:
		A[i] = N % 2
		i -= 1
		N = floor(N / 2)
	return A

def ConverttoDecimal(A):
	fact = 1
	num = 0
	for i in range(32):
		num = num + A[i] * 2 ** (31 - i)
	return num

def flipbits(A):
	for i in range(32):
		if A[i] == 1:
			A[i] = 0
		else:
			A[i] = 1
	return A
T = int(input())
for i in range(T):
	N = int(input())
	print(ConverttoDecimal(flipbits(ConverttoBinary(N))))


times = int(input())
for _ in range(times):
	num = bin(int(input()))
	num = '0' * (34 - len(num)) + num[2:]
	newnum = ''
	for d in num:
		if d == '1':
			newnum += '0'
		if d == '0':
			newnum += '1'
	print(int(newnum, 2))


import sys
firstLine = True
for line in sys.stdin:
	if firstLine:
		firstLine = None
		continue
	print(int('11111111111111111111111111111111', 2) - int(line))


t = int(input())
numbers = []

def generate_zero(i):
	zero = ''
	for i in range(32 - i):
		zero = zero + '0'
	return zero
for i in range(t):
	a = int(input())
	a = '{0:b}'.format(a)
	zero = generate_zero(len(a))
	a = zero + a
	a = list(a)
	for i in range(len(a)):
		if a[i] == '0':
			a[i] = '1'
		else:
			a[i] = '0'
	a = str(''.join(a))
	a = int(a, 2)
	numbers.append(a)
for item in numbers:
	print(item)


lineCount = int(input())
for i in range(lineCount):
	print(int(input()) ^ 2 ** 32 - 1)


def convert(decNum):
	binArr = []
	answer = ''
	while decNum > 0:
		if decNum % 2 == 0:
			binArr.append('1')
			decNum = decNum / 2
		else:
			binArr.append('0')
			decNum = decNum / 2 - 0.5
	while len(binArr) < 32:
		binArr.append('1')
	for i in range(31, -1, -1):
		answer += binArr[i]
	return answer
T = int(input())
count = 0
while count < T:
	inpt = int(input())
	converted = convert(inpt)
	outpt = int(converted, 2)
	print(outpt)
	count += 1


for x in range(0, int(input())):
	print(~int(input()) + 2 ** 32)


t = int(input())
for x in range(t):
	num = int(input())
	s1 = bin(num)[2:]
	newStr = '0b' + '1' * (32 - len(s1))
	for ch in s1:
		if ch == '0':
			newStr += '1'
		else:
			newStr += '0'
	print(int(newStr, 2))


import sys
mask = 4294967295
t = int(input())
for _ in range(t):
	x = int(input())
	print(mask ^ x)


test_cases = int(input())
for i in range(test_cases):
	number = int(input())
	print(~number & 4294967295)


M = 4294967295
LIST = [int(input()) for i in range(int(input()))]
for number in LIST:
	print(M - number)


t = int(input())
a = 1
while a <= t:
	y = 2 ** 32 - int(input()) - 1
	print(y)
	a = a + 1


num_inputs = int(input())
inputs = []
for i in range(num_inputs):
	inputs.append(int(input()))
for i in range(num_inputs):
	print(pow(2, 32) - 1 - inputs[i])