As you all must know, ICPC is one of the most prestigious competitions in the field of computer science. This year, team Limscape is one of the strongest teams in the Caribbean Region, and they are training harder in order to advance to the 2020 ICPC World Finals. They recently took part in the Caribbean Local Contest and they could not solve only one problem, so they ended up tied in number of solved problems with teams UZ**, Frickyfox and VLCU.h. Now they want to solve it off-contest, and they ask for your help, due to your knowledge in Competitive Programming field. The problem was the following:
You are given a simple polygon (it doesn't intersect or touch with itself) consisting of $n$ vertices. A triangulation of this polygon is a subdivision in $n-2$ triangles, defined by a set of non-intersecting diagonals, in which the vertices of the triangles are also vertices of the polygon. Each vertex $i$ has a special value $v_{i}$ associated. We define the cost of a triangle as the bitwise XOR operation of the special values of vertices that form the triangle, and the cost of a triangulation as the sum of the costs of the triangles that compose it. We are interested in calculating the minimum possible value of a triangulation for such polygon.