dist m thing to n such that remaining differece square sum min