The kingdom is an infinite flat plane with no borders. It holds n gathering locations.
The king wanted a closer look at his people, so he planned a trip through all of them with a speech at each one. The original plan is the polygonal chain p1→p2→⋯→pn.
The king is old, so his assistants want to cut the number of speeches by skipping some locations. The new plan has to be a polygonal chain over a subsequence of p that starts at p1 and ends at pn, that is, pi1→pi2→⋯→pim with 1=i1<i2<⋯<im=n.
A location pj with ik<j<ik+1 can be skipped only if the distance from pj to the segment pikpik+1 is at most d. If that distance exceeds d, the king refuses to drop the location.


Find the new route with the smallest possible number of locations.