atcoder#DIVERTA20192B. Picking Up

Picking Up

Score : 300300 points

Problem Statement

There are NN balls in a two-dimensional plane. The ii-th ball is at coordinates (xi,yi)(x_i, y_i).

We will collect all of these balls, by choosing two integers pp and qq such that p0p \neq 0 or q0q \neq 0 and then repeating the following operation:

  • Choose a ball remaining in the plane and collect it. Let (a,b)(a, b) be the coordinates of this ball. If we collected a ball at coordinates (ap,bq)(a - p, b - q) in the previous operation, the cost of this operation is 00. Otherwise, including when this is the first time to do this operation, the cost of this operation is 11.

Find the minimum total cost required to collect all the balls when we optimally choose pp and qq.

Constraints

  • 1N501 \leq N \leq 50
  • xi,yi109|x_i|, |y_i| \leq 10^9
  • If iji \neq j, xixjx_i \neq x_j or yiyjy_i \neq y_j.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

x1x_1 y1y_1

::

xNx_N yNy_N

Output

Print the minimum total cost required to collect all the balls.

2
1 1
2 2
1

If we choose p=1,q=1p = 1, q = 1, we can collect all the balls at a cost of 11 by collecting them in the order (1,1)(1, 1), (2,2)(2, 2).

3
1 4
4 6
7 8
1

If we choose p=3,q=2p = -3, q = -2, we can collect all the balls at a cost of 11 by collecting them in the order (7,8)(7, 8), (4,6)(4, 6), (1,4)(1, 4).

4
1 1
1 2
2 1
2 2
2