import java.util.ArrayList;
import java.util.List;
public class RobotGroups {
static int find(int x, List<Integer> parent)
{
if (x == parent.get(x))
return x;
parent.set(x, find(parent.get(x), parent));
return parent.get(x);
}
static boolean union(int x, int y, List<Integer> parent,
List<Integer> rank)
{
int lx = find(x, parent);
int ly = find(y, parent);
if (lx != ly) {
if (rank.get(lx) > rank.get(ly)) {
parent.set(ly, lx);
}
else if (rank.get(lx) < rank.get(ly)) {
parent.set(lx, ly);
}
else {
parent.set(lx, ly);
rank.set(ly, rank.get(ly) + 1);
}
return true;
}
return false;
}
static int solve(List<int[]> robots, int k)
{
int n = robots.size();
int cc = n;
List<Integer> parent = new ArrayList<>(n);
List<Integer> rank = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
parent.add(i);
rank.add(1);
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
long x1 = robots.get(i)[0],
y1 = robots.get(i)[1];
long x2 = robots.get(j)[0],
y2 = robots.get(j)[1];
long x = (x2 - x1) * (x2 - x1)
+ (y2 - y1) * (y2 - y1);
if (x * x <= k * k) {
boolean merge
= union(i, j, parent, rank);
if (merge)
cc--;
}
}
}
return cc;
}
public static void main(String[] args)
{
List<int[]> robots = new ArrayList<>();
robots.add(new int[] { 13, -62 });
robots.add(new int[] { 3, 3 });
robots.add(new int[] { 2, 2 });
int K = 2;
int result = solve(robots, K);
System.out.println(result);
}
}