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

for i in range(n):
    for j in range(n-i-1):
        ai = format(a[i],"b")
        aj = format(a[i+j+1],"b")
        if len(ai) <= len(aj) :
            ai = "0"*(len(aj)-len(ai)) + ai
        else:
            aj = "0"*(len(ai)-len(aj)) + aj
        num = ""
        for k in range(len(ai)):
            if ai[k] ==aj[k]:
                num = num + "0"
            else:
                num = num + "1"
        ans += int(num,2)
        ans = ans%(1000000007)
print(ans)
        