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 int ans=100; 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[] win=new int[n]; ArrayList array=new ArrayList(); for(int i=0;i array){ if(depth==array.size()||array.isEmpty()){ int r=checkRank(win); ans=Math.min(ans,r); return; } Pair p=array.get(depth); int x=p.x; int y=p.y; win[x]++; dfs(depth+1,win,array); win[x]--; win[y]++; dfs(depth+1,win,array); win[y]--; } public static int checkRank(int[] win){ int[] winc=(int [])win.clone(); int cnt=1; int now; int prev=INF; Arrays.sort(winc); for(int i=winc.length-1;i>=0;i--){ now=winc[i]; if(win[0]==now) return cnt; if(win[0]