function main()
	N=parse(Int,readline())
	A=map(x->parse(Int,x),split(readline()))
	ans=0
	mod=10^9+7
	for i=59:-1:0
		c=0
		for a=A
			c+=(a>>i)%2
		end
		ans=(ans*2+c*(N-c))%mod
	end
	println(ans)
end
main()