For a tree , rooted at node , having values at nodes, and a node , lets define as the bitwise xor of all values in the subtree of node .
You are given a tree . Let be the tree remaining after removing all nodes in subtree of . Define . You have to find sum of over all nodes .
Input:
First line contains a single integer , denoting the number of nodes in the tree . Next line contains space separated integers denoting the values of nodes in the tree , integer being the value of node $i$. Each of the next lines contain space separated integers and , meaning that there is an edge from node to node .
Output:
Print a single integer, the sum of for all nodes (except ) of the tree .
Constraints:
.