def main():
    n = int(input())
    a = tuple(map(int,input().split()))
    b = [a[i]^a[j] for i in range(n-1) for j in range(i+1,n)]

    ans = sum(b)%(10**9+7)
    print(ans)

if __name__ == '__main__':
    main()