P25429 [AtCoder] Picking Up
普及
题目描述

Problem Description

On a 2D plane, there are $N$ balls, and the $i$-th ball is located at $(x_i, y_i)$.

First, decide on two integers $p, q$ such that $p \neq 0$ or $q \neq 0$. Then, repeat the following operation to collect all the balls:

  • Choose one of the remaining balls to collect. Let the coordinates of this ball be $(a, b)$. At this time, if the coordinates of the previously chosen ball are $(a - p, b - q), the cost is $0$; otherwise, the cost is $1$. Note that the first ball chosen always incurs a cost of $1$.

Calculate the minimum total cost to collect all the balls when $p, q$ are chosen optimally.

Input Format

The input is given from the standard input in the following format:

$N$ $x_1$ $y_1$ $:$ $x_N$ $y_N$

Output Format

Output the minimum total cost to collect all the balls.

Sample Input and Output

Sample Input #1

2
1 1
2 2

Sample Output #1

1

Sample Input #2

3
1 4
4 6
7 8

Sample Output #2

1

Sample Input #3

4
1 1
1 2
2 1
2 2

Sample Output #3

2

Notes/Hints

Constraints

  • $1 \leq N \leq 50$
  • $|x_i|, |y_i| \leq 10^9$
  • $x_i \neq x_j$ or $y_i \neq y_j$ $(i \neq j)$
  • All inputs are integers

Sample Explanation 1

If $p = 1, q = 1$, you can collect all the balls with a cost of $1$ by choosing the balls at $(1, 1)$ and $(2, 2)$ in that order.

Sample Explanation 2

If $p = -3, q = -2$, you can collect all the balls with a cost of $1$ by choosing the balls at $(7, 8)$, $(4, 6)$, and $(1, 4)$ in that order.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1 1 2 2
样例输出
1