Problem: You are given a tree consisting of vertices. A number is written on each vertex; the number on vertex is equal to .
Recall that a simple path is a path that visits each vertex at most once. Let the weight of the path be the bitwise XOR of the values written on vertices it consists of. Let's say that a tree is good if no simple path has weight .
You can apply the following operation any number of times (possibly, zero): select a vertex of the tree and replace the value written on it with an arbitrary positive integer. What is the minimum number of times you have to apply this operation in order to make the tree good?
Input Format: The first line contains one integer () — the number of vertices.
The second line contains integers , , ..., () — the numbers written on vertices.
Then lines follow, each containing two integers and () denoting an edge connecting vertex with vertex . It is guaranteed that these edges form a tree.
Output Format: Print a single integer — the minimum number of times you have to apply the operation in order to make the tree good.
Note: In the first example, it is enough to replace the value on the vertex with , and the value on the vertex with .