def main():
    N = int(input())
    a = list(map(int, input().split()))
    m = 10 ** 9 + 7
    ans = 0

    for i in range(N - 1):
        for j in range(i + 1, N):
            tmp = a[i] ^ a[j]
            ans += tmp % m
            ans %= m

    print(ans)

if __name__ == '__main__':
    main()
    