|
Xiaomei likes to play with blocks. She stacked the blocks one by one into boxes of different heights.“Look, I built a wall!”She told her eldest sister Xiaoliang.“Well, you should build all the blocks the same height. So you build a real wall.”She replied. After thinking for a while, Xiaomei thought she was right. Then, she began to rearrange the blocks, one after another, and finally, all the blocks were the same height. But Xiaomei is lazy, she wants to move only the minimum number of blocks to make all the blocks the same height. Can you help her?
Enter a description: The input contains multiple data collections. The first row of each data set is an integern, which represents the number of columns of the building blocks of Xiaomei. The second line containsnintegers, each representing the height of each block columnhi, indicates that there is in the columnhi blocks. Assumed1≤n≤50,1≤hi≤100。 The total number of blocks is divisible by the number of columns. Therefore, it is guaranteed that each column will be stacked at the same height. The input ends with 0, and 0 is not used as input data. Output Description: For each dataset, print out the serial number of the dataset, see the output example. Then print the text "The minimum number of moves is k.". Here, k refers to the minimum number of times it takes to move these blocks to the same height. Output one empty row after each dataset. Input example: 6 5 2 4 1 7 5 0 Output sample Set #1 The minimum number of moves is 5.
|