def main():
    n = int(input())
    a = list(map(int, input().split()))
    mod = int(10e8+7)
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            s = a[i]
            t = a[j]
            s ^= t
            ans += s%mod
    ans = ans%mod
    print(ans)



if __name__ == "__main__":
    main()