import java.io.*; import java.util.ArrayList; import java.util.Arrays; class Main{ static final PrintWriter out=new PrintWriter(System.out); static final int INF=Integer.MAX_VALUE/2; static class Pair{ int x; int y; Pair(int x,int y){ this.x=x; this.y=y; } } public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine())!=null&&!line.isEmpty()){ int n=Integer.parseInt(line); int[][] res=new int[n][n]; int[] win=new int[n]; ArrayList array=new ArrayList(); for(int i=0;ij&&j!=0) array.add(new Pair(i,j)); } } } for(int i=0;i array){ if(depth==array.size()){ int r=checkRank(win); ans=Math.min(ans,r); } Pair p=array.get(depth); int x=p.x; int y=p.y; res[x][y]=1; res[y][x]=0; win[x]++; dfs(depth+1,ans,res,win,array); win[x]--; res[x][y]=0; res[y][x]=1; win[y]++; dfs(depth+1,ans,res,win,array); } private static int checkRank(int[] win){ int[] winc=win.clone(); int cnt=1; int prev=0; Arrays.sort(winc); for(int i=winc.length-1;i>=0;i--){ if(win[0]