program bzoj_1854; const maxn=1000000; var l:array[1..2*maxn]ofrecord ed,pre:longint; end; p,num:array[1..maxn]of longint; lst:array[1..10000]of longint; n,i,a,b,tot,cnt:longint; procedurelink(a,b:longint); begin inc(tot); l[tot].pre:=lst[a]; lst[a]:=tot; l[tot].ed:=b; end; functionpath(x:longint):boolean; var k:longint; begin k:=lst[x]; while k<>0do begin if num[l[k].ed]<>cnt then begin num[l[k].ed]:=cnt; if (p[l[k].ed]=0)or(path(p[l[k].ed])) then begin p[l[k].ed]:=x; exit(true); end; end; k:=l[k].pre; end; exit(false); end; functionhungary:longint; var i:longint; begin cnt:=0; for i:=1to10001do begin inc(cnt); ifnot path(i) thenbreak; end; exit(i-1); end; begin readln(n); tot:=0; for i:=1to n do begin readln(a,b); link(a,i); link(b,i); end; writeln(hungary); end.