St Andrews Online Judge

Two Medics at CS Ball

By Kay Akashi

Time: 3000 ms
Memory: 256000 kB

Loading account information...

Loading account information...

Problem Statement

Kay is an introvert. However, he determined to make new friends. Thus, he's bought a ticket for Computer Science Ball happening soon, although he's not a CS student.

But Kay is an introvert. Because he's too frightened to go there by himself, he asked his friend Liana in his medicine class to join him.

Now Kay and Liana are in the ball venue. It looks like NN CS students are there, meaning there're N+2N + 2 people there in total.

But Kay is an introvert. He ends up with talking only to Liana and never tries to socialise with others at all. Moreover, he's feeling annoyed (how selfish he is!) when a pair of two CS students is standing in a way that the line segment between them intersects with that between Kay and Liana. Note that, Kay is such a selfish person who also gets annoyed when at least one person of the pair is standing on the line segment betweek Kay and Liana. Also, he gets annoyed when either Kay or Liana is on the line segment between a pair of two CS students.

The venue is expressed as a two-dimensional graph with x and y-axes. Everyone's locations have non-negative integer values on both x and y-axes. Kay is standing at (Kx,KyK_x, K_y), Liana is standing at (Lx,LyL_x, L_y). Other NN CS students are standing at (XiX_i, YiY_i) (1iN1 \leq i \leq N). Your task is to count the number of pairs that annoy miserable Kay.

Constraints

1N2001 \leq N \leq 200. 0Kx,Ky,Lx,Ly,Xi,Yi5000 \leq K_x, K_y, L_x, L_y, X_i, Y_i \leq 500. All the locations are provided as integers.

Input

The first line of input contains a single integer NN, the number of CS students joining the ball. The second line of input contains 44 integers, KxK_x, KyK_y, LxL_x, and LyL_y, locations of Kay and Liana. Then, NN lines follow, each of which contains 22 integers, XiX_i and YiY_i, the location of student ii.

It is ensured that no two persons are standing at the exact same location.

Output

Output a single integer, the number of pairs that annoy Kay.

Examples

Input

4
3 0 3 3
0 0
100 101
6 4
100 100

Output

2

Explanation

Student 11 and 33 are annoying Kay, because the line segment between them intersects with that between Kay and Liana at (xx, yy) = (33, 22). Also, student 11 and 44 are annoying Kay because Liana is standing between them. No other pair annoys Kay, so output 22, the total number of annoying pairs to Kay.

Input

1
28 83 74 92
64 73

Output

0

Explanation

No matter where the CS student is standing, Kay never gets annoyed because there's no "pair" of CS students who can annoy him. In such a case, output 00.

Input

2
3 0 3 3
0 0
1 1

Output

0

Explanation

Note that, student 11 and 22 are not annoying Kay at all in this scenario.

Input

15
245 61 115 444
345 134
3 131
74 99
234 339
89 77
10 10
75 75
92 111
111 500
88 290
72 73
77 11
0 88
66 91
111 300

Output

24