import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class game { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(new File("game.in")); for (;;) { int n = sc.nextInt(); if (n==0) break; long[] a = new long[n]; for (int i=0; i