import sys
input = sys.stdin.readline


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


if __name__ == '__main__':
    main()
