def main():
    N = int(input())
    li = [-1] + list(map(int, input().split()))
    S = 0
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            S += (li[i] ^ li[j]) % (10 ** 9 + 7)
    print(S)



if __name__ == "__main__":
    main()
