Only check 1..n^2-1 when computing the manhattan distance.