function Main(input) {
    input = input.split("\n");
    var n = parseInt(input[0], 10);//10000
    var num = input[1].split(' ');//1000000
    for(var i=0; i<n; i++){
      for(var j=2; j<1000001; j++){
        for(var k=0; k<n; k++){
          if(i != k){
            if(j==3 && k==1 && i==0){
            }
            if(numA[k][j]-numA[i][j]-ansA[i][j] > 0){
              ansA[i][j] += numA[k][j]-numA[i][j]-ansA[i][j];
            }
          }
        }
      }
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
