CF1625D Binary Spiders

Description

Binary Spiders are species of spiders that live on Mars. These spiders weave their webs to defend themselves from enemies. To weave a web, spiders join in pairs. If the first spider in pair has $ x $ legs, and the second spider has $ y $ legs, then they weave a web with durability $ x \oplus y $ . Here, $ \oplus $ means bitwise XOR. Binary Spiders live in large groups. You observe a group of $ n $ spiders, and the $ i $ -th spider has $ a_i $ legs. When the group is threatened, some of the spiders become defenders. Defenders are chosen in the following way. First, there must be at least two defenders. Second, any pair of defenders must be able to weave a web with durability at least $ k $ . Third, there must be as much defenders as possible. Scientists have researched the behaviour of Binary Spiders for a long time, and now they have a hypothesis that they can always choose the defenders in an optimal way, satisfying the conditions above. You need to verify this hypothesis on your group of spiders. So, you need to understand how many spiders must become defenders. You are not a Binary Spider, so you decided to use a computer to solve this problem.

Input Format

N/A

Output Format

N/A

Explanation/Hint

Consider the examples above. In the first example, the group of spiders is illustrated on the picture below: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1625D/1010007e17d60a2fb95617e44d5646f679fa1136.png)We choose the two-legged, the ten-legged and the $ 16 $ -legged spiders. It's not hard to see that each pair may weave a web with enough durability, as $ 2 \oplus 10 = 8 \ge 8 $ , $ 2 \oplus 16 = 18 \ge 8 $ and $ 10 \oplus 16 = 26 \ge 8 $ . This is not the only way, as you can also choose, for example, the spiders with indices $ 3 $ , $ 4 $ , and $ 6 $ . In the second example, no pair of spiders can weave the web with durability $ 1024 $ or more, so the answer is $ -1 $ .