import numpy as np
mod = 10 ** 9 + 7

if __name__ == "__main__":
	N = int(input())
	L = list(map(int, input().split()))
	L = np.array(L)
	ans = 0
	for i in range(60 + 2):
		A = L % 2
		L = L // 2
		ans += np.sum(A) * (N - np.sum(A)) * (2 ** i) % mod
	print(ans % mod)