Part of the problem I am solving requires to minimize the sum defined below.

Given N points on a straight line. It is sure that all points lie on the line, and the line has a slope = 1). We have to choose 1 point among them and find the sum of distances of all other points from this point.

This sum should be the minimum.

problem link

I haven’t read the editorial, I thought of an approach but can’t apply it.

Any help would be great.