N = int(input())
S = input().split()
A = []
Su = 0
for c in S:
    A.append(int(c))
for i in range(N):
    for j in range(i+1, N):
        X = ((A[i] | A[j]) & (~A[i] | ~A[j]))
        Su += X
print(Su % (10**9+7))