D. Cuantos trujos?
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A mapping company is testing a new signal simulation system. They have placed $$$N$$$ signal towers at different positions on a flat map. Each tower is located at coordinates $$$(x_i, y_i)$$$, where $$$1 \le x_i, y_i \le 2 \cdot 10^5$$$, all $$$y_i$$$ values are distinct and all $$$x_i$$$ values are distinct as well, additionally, there are no three colinear points.

To analyze signal interference, the company draws a virtual line between every pair of towers. These lines are extended downward, and the engineers are interested in how these lines affect positions on a distant horizontal scan line at $$$y = -10^{18}$$$.

They define a function $$$f(x)$$$ for real numbers $$$x$$$, which represents interference at horizontal position $$$x$$$ on the scan line. Initially, $$$f(x) = 0$$$ for all $$$x$$$.

Then, for every pair of towers $$$i \lt j$$$, the following process is applied:

  • Consider the directed line from point $$$i$$$ to point $$$j$$$.
  • For a fixed real number $$$x$$$, consider the point $$$(x, -10^{18})$$$.
    • If this point is on or to the left of the line (remember that the line is directed from point $$$i$$$ to point $$$j$$$), then update $$$f(x) := f(x) \oplus a$$$.
    • If it is to the right of the line, then update $$$f(x) := f(x) \oplus b$$$.

Here, $$$\oplus$$$ denotes the bitwise XOR operation.

After processing all pairs, the function $$$f(x)$$$ becomes piecewise constant: the real line is divided into a number of intervals where $$$f(x)$$$ has the same value. We define a Trujo as any such interval where $$$f(x) = 0$$$.

Your task is to count how many Trujos appear on the real number line.

Input

The first line contains three integers $$$N$$$, $$$a$$$, and $$$b$$$ $$$(2 \le N \le 2 \cdot 10^5,\ 0 \le a,b \le 10^9)$$$.

The next $$$N$$$ lines each contain two integers $$$x_i$$$, $$$y_i$$$ $$$(1 \le x_i, y_i \le 4 \cdot 10^5)$$$. All $$$y_i$$$ values are distinct and all $$$x_i$$$ values are distinct, additionally, there are no three colinear points.

Output

Print one integer — the number of Trujos, i.e., the number of intervals on the real number line where $$$f(x) = 0$$$.

Example
Input
4 7 12
1 7
7 5
3 10
4 9
Output
4