By Kay Akashi
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 CS students are there, meaning there're 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 (), Liana is standing at (). Other CS students are standing at (, ) (). Your task is to count the number of pairs that annoy miserable Kay.
. . All the locations are provided as integers.
The first line of input contains a single integer , the number of CS students joining the ball. The second line of input contains integers, , , , and , locations of Kay and Liana. Then, lines follow, each of which contains integers, and , the location of student .
It is ensured that no two persons are standing at the exact same location.
Output a single integer, the number of pairs that annoy Kay.
4
3 0 3 3
0 0
100 101
6 4
100 100
2
Student and are annoying Kay, because the line segment between them intersects with that between Kay and Liana at (, ) = (, ). Also, student and are annoying Kay because Liana is standing between them. No other pair annoys Kay, so output , the total number of annoying pairs to Kay.
1
28 83 74 92
64 73
0
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 .
2
3 0 3 3
0 0
1 1
0
Note that, student and are not annoying Kay at all in this scenario.
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
24