def solve(a,n):
	s = 0
	mod = 1000*1000*1000 + 7
	for i in range(0,32):
		zc,oc = 0,0
		for j in range(n):
			if a[j]%2!=0:
				oc+=1
			else:
				zc+=1
			a[j] = a[j]//2
		l = oc%mod * zc%mod * (1<<i)%mod
		s = s + l
		s %= mod
	return s

n = int(input())
a = list( map(int,input().split()) )

ans = solve(a,n)
print(ans)

