Make this into a number line like this:
The sum of the distances from P to A, B, C, D, and E, respectively, are \(|x| + |x-1| + |x-2| + |x-5| + |x-7|\).
P will be equal to the x value that will result in the minimum possible distance.
The global minimum will only occur in critical points, which in this case are 0, 1, 2, 5, and 7.
Testing them out, 2 will result in the smallest possible sum of the distances of 11. \(\)
That means P will be on point C, which means AP will be equal to \(\boxed{2}\)
(by the way, I'm not too good at calculating global minima, so maybe there is a faster way to do it than to just test out critical points)