Graph on a Plane
Обмеження: 4 сек., 512 МіБ
You are given nn unique points (xi,yi)(xi,yi) on a two-dimensional plane.
A weighted undirected graph GG with real-valued weights is good if it satisfies the following conditions.
GG contains nn vertices numbered 11 through nn.
For each pair of vertices (i,j)(i,j), the shortest-path weight between vertices ii and jj in GG equals the Euclidean distance between points (xi,yi)(xi,yi) and (xj,yj)(xj,yj).
Find the minimum number of edges in a good graph.
Вхідні дані
The first line contains an integer nn – the number of points.
The following nn lines contain two integers xixi and yiyi – coordinates of the points.
Вихідні дані
In a single line, print an integer – the minimum number of edges in a good graph.
Обмеження
1≤n≤20001≤n≤2000,
|xi|,|yi|≤109|xi|,|yi|≤109.
All points are distinct.
Приклади
Вхідні дані (stdin) | Вихідні дані (stdout) |
---|---|
4 0 0 4 3 4 2 0 4 | 6 |
Вхідні дані (stdin) | Вихідні дані (stdout) |
---|---|
5 0 0 1 0 0 2 -3 0 0 -4 | 8 |