G. Xor-MSTtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a complete undirected graph with n vertices. A number ai is assigned to each vertex, and the weight of an edge between vertices i and j is equal to ai xor aj.Calculate the weight of the minimum spanning tree in this graph.InputThe first line contains n (1 ≤ n ≤ 200000) — the number of vertices in the graph.The second line contains n integers a1, a2, ..., an (0 ≤ ai < 230) — the numbers assigned to the vertices.OutputPrint one number — the weight of the minimum spanning tree in the graph.ExamplesInput51 2 3 4 5Output8Input41 2 3 4Output8
Input51 2 3 4 5
Output8
['bitmasks', 'constructive algorithms', 'data structures', '*2300']