import java.util.*;
import java.io.*;
class Solution {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = 10;
for (int i = 0; i < T; i++) {
int dump = Integer.parseInt(br.readLine());
String[] s = br.readLine().split(" ");
int[] box = new int[100];
for (int j = 0; j < box.length; j++) {
box[j] = Integer.parseInt(s[j]);
}
for (int j = 0; j < dump; j++) {
Arrays.sort(box);
if (box[99] - box[0] <= 1) {
break;
}
box[99]--;
box[0]++;
}
Arrays.sort(box);
System.out.println("#" + (i + 1) + " " + (box[99] - box[0]));
}
}
}