CCCGuide

Problem S5: Lazy Fox

2014 · S5 · Original problem · DMOJ

Problem Description

You have a pet Fox who loves treats. You have NN neighbours at distinct locations (described as points on the Cartesian plane) which hand out treats to your pet Fox, and each neighbour has an unlimited number of treats to give out. The origin (which is where the Fox starts) will not be one of these NN locations.

What does the Fox say, in order to get these treats? That is a good question, but not our concern.

The Fox moves from location to location to gather exactly one treat from each location on each visit. He can revisit any previous location, but cannot visit the same location on two consecutive visits.

Your Fox is very lazy. The distance your Fox is willing to travel after each treat will strictly decrease. Specifically, the distance from the origin to his first treat location must be larger than the distance from his first treat location to his second treat location, which in turn is larger than the distance between his second treat location and his third treat location, and so on.

What is the largest number of treats your Fox gathers?

Input Specification

The first line contains the integer N (1≤N≤2000)N~(1 \leq N \leq 2000). The next NN lines each contain XiX_i, followed by a space, followed by YiY_i, for i=1..N (−10 000≤Xi,Yi≤10 000)i=1..N~(-10\ 000 \leq X_i, Y_i \leq 10\ 000) representing the coordinates of the iith location. The following additional constraints will apply.

Output Specification

The output is one integer, the largest number of treats your Fox can gather.

Sample Input

5
5 8
4 10
3 1
3 2
3 3

Output for Sample Input

6

Explanation of Output for Sample Input

The Fox performs the visits in the following order (with the indicated distances):