n = int(input())
a = list(map(int,input().split()))
s =[0]*n
ans =0
ans2 =0

def xor(x,ans,k):
	for j in range(k,n):
		s[j] = format(x ^ a[j])
		s[j] = int(s[j])
		ans+=s[j]

	return ans

for i in range(n-1):
	ans2 +=xor(a[i],ans,i+1)

print(ans2%(10**9+7))
