| OCPC 2025 Summer, Day 2: KIT Contest |
|---|
| Finished |
There are $$$n$$$ countries arranged in a straight line. Each country has a fighting power $$$p$$$. We skip the definitely very reasonable explanation of why the combined fighting power of two countries is the bitwise XOR of their two fighting powers.
A pair of countries $$$(l, r)$$$, where $$$l \lt r$$$, is called dangerous if their combined fighting power is stronger than every single fighting power of the countries between them and is also stronger than the two countries on their own. Formally, $$$p_l \oplus p_r \gt \max_{i=l}^r p_i$$$.
Count the number of dangerous pairs of countries.
The input consists of:
Output one integer, the number of dangerous pairs.
43 2 4 1
3
76 2 3 1 5 11 0
5
| Name |
|---|


