import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    a = tuple(map(int,input().split()))
    b = []
    mod = 10**9+7

    for i in range(n-1):
        for j in range(i+1,n):
            b.append((a[i]^a[j])%mod)

    ans = sum(b)
    print(ans)

if __name__ == '__main__':
    main()