def main():
    N = int(input())
    A = list(map(int, input().split()))
    sum = 0
    for i in range(N):
        for j in range(i,N):
            sum += A[i]^A[j]
            sum%=1000000007
    print(sum)

if __name__ == '__main__':
    main()
