Let us call the distance between the numbers a1a2a3a4a5 and b1b2b3b4b5 the maximum i for which ai=bi. All five-digit numbers are written out one after another in some order. What is the minimum possible sum of distances between adjacent numbers? number theorycombinatoricsDigits