#P1661F. Teleporters
Teleporters
Description
There are teleporters on a straight line, located in points , , , , ..., . It's possible to teleport from point to point if there are teleporters in both of those points, and it costs energy.
You want to install some additional teleporters so that it is possible to get from the point to the point (possibly through some other teleporters) spending no more than energy in total. Each teleporter you install must be located in an integer point.
What is the minimum number of teleporters you have to install?
The first line contains one integer ().
The second line contains integers ().
The third line contains one integer ().
Print one integer — the minimum number of teleporters you have to install so that it is possible to get from to spending at most energy. It can be shown that it's always possible under the constraints from the input format.
Input
The first line contains one integer ().
The second line contains integers ().
The third line contains one integer ().
Output
Print one integer — the minimum number of teleporters you have to install so that it is possible to get from to spending at most energy. It can be shown that it's always possible under the constraints from the input format.