import itertools

def main():
	N = int(input())
	A = map(int, input().split())
	sum = 0
	for i, j in  itertools.combinations(A, 2):
		sum = sum + (i ^ j)
	print( sum % (10**9+7))


if __name__ == '__main__':
	main()
