from sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))

    ans = 0

    for i in range(n - 1):
        for j in range(i + 1, n):
            ans += a[i] ^ a[j]
            ans %= mod

    print(ans % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
