Fold Magic


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python, Rust

YOU: "Parsa. You're the founder of the MCPC right?"

PARSA: "That's Lord Prime Minister and Supreme Intellectual Commander of MAPS to you."

YOU: "Right. And MCPC is a rival of ACPC? I think you know what I'm going to ask next."

PARSA: "No, I didn't do anything to Kevin. We'd probably benefit from it, I mean, who would join a club where a member died? But murder's a bit far just for membership. Besides, your club's actually pretty cool. I was wandering around all afternoon, taking notes, meeting people."

YOU: "Okay, so you got around. Anything suspicious you heard around quarter to six?"

PARSA: "I was with Rory around then. He seemed overwhelmed, and annoyed at Kevin. A lot of people I spoke to had a problem with Kevin. Replaceable, that's the word that kept coming up. Everyone felt replaceable. MCPC could never be that disorganised."

Parsa has been roaming around the ACPC Ball all evening, taking notes on how ACPC operates in order to best understand how to take them down. However, due to his strength, he kept accidentally poking holes in his note paper while he was trying to walk. Thus, he has a sheet of paper with numerous holes in it.

As the night draws on, Parsa realises that he can't be seen removing the notes from the venue, and the sheet is currently too large to fit in any of his pockets. He resolves to fold the sheet along a line through the centre (0,0) so that it is small enough to smuggle out. Moreover, he wants to impress some bystanders by performing a magic trick during the fold! He states that he will make some of the page holes disappear!

Parsa can choose any line that passes through the centre of the page. A hole "disappears" if, after folding along that line, it coincides exactly with another hole on the folded page. What is the maximum number of disappearances Parsa can achieve with one fold?

Folding along a line means choosing one side of the line and reflecting every point on that side across the line. Points on the fold line do not move.

Input

The first line contains a single integer n (1 \leq n \leq 2000), the number of holes Parsa has poked in his sheet throughout the night.

The next n lines each contain two integers x_i,y_i (-10^9 \leq x_i,y_i \leq 10^9), representing the position of the ith hole on the page. None of these holes coincide with each other.

Output

Output a single integer: the maximum number of holes that Parsa can make disappear by making a single fold along a line through (0,0). When a pair of holes coincide exactly after the fold, that counts as one disappearance.

Example

Input 1
5
2 0
-1 2
5 2
0 2
2 -1
Output 1
2

In this case the optimal solution is fairly simple to see: reflection over the line y=x corresponds to swapping the x and y coordinates of a point, and that would make (2,0) coincide with (0,2), and (-1,2) coincide with (2,-1). The maximum number of disappearances for n holes is \left\lfloor \frac{n}{2} \right\rfloor, so in this case there cannot be any better line to fold along.

Input 2
4
0 0
1 0
2 0
3 0
Output 2
0

Even though all holes lie on the same line through the centre, folding along that line leaves them where they are, so no two holes coincide. Folding along any other line also cannot make two of these holes coincide.

Input 3
8
1 5
5 -1
-8 -1
-4 -7
-4 6
4 -6
7 0
-1 4
Output 3
3

Folding along the line y = \frac{2}{3}x makes the three pairs (1,5) and (5,-1), (-8,-1) and (-4,-7), and (-4,6) and (4,-6) coincide.

Input 4
2
1 0
-1 0
Output 4
1

It is also possible to fold along a vertical line, even though this cannot be expressed in a function of the form y=f(x).


Comments

There are no comments at the moment.