
def main():
    from itertools import combinations

    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    ans = 0
    for i in combinations(a, 2):
        ans += i[0] ^ i[1]
        ans %= mod

    print(ans)

if __name__ == "__main__":
    main()