MOD = 10**9 + 7

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    ans = 0
    for i in range(0, n-1):
        for j in range(i, n):
            temp = a_list[i] ^ a_list[j]
            ans += temp % MOD

    print(ans % MOD)


if __name__ == '__main__':
    main()
