MOD = (10**9)+7
N = int(input())


def main():
    sum_ = 0
    A = list(map(int, input().split()))
    for i in range(len(A)-1):
        for j in range(i+1, len(A)):
            sum_ += A[i] ^ A[j]
    print(sum_ % MOD)


if __name__ == "__main__":
    main()
