Calculating fintess using distance