def main():
	n, *a = map(int, open(0).read().split())
	mod = 10 ** 9 + 7
	l = [[x >> k & 1 for k in range(61)] for x in a]
	ll = [sum(t) for t in zip(*l)]
	ans = sum(s * (n - s) * (1 << i) % mod for i, s in enumerate(ll))
	print(ans % mod)

if __name__ == "__main__":
	main()