$n=<>;/ /,push@{$n-$`},$n-$' for<>;print$|x($f|=$b[$i]=$|=grep!$b[$_],@$i)while$i++<$n