{"raw_statement":[{"iden":"problem statement","content":"$N$ students, numbered $1,2,\\ldots,N$, took an examination. Student $i\\,(1 \\leq i \\leq N)$ had to score at least $B_i$ points to graduate, where they actually scored $A_i$ points.\nYou can repeat the following operation any number of times (possibly zero):\n\n*   Choose two students, and swap their scores.\n\nYour goal is to make everyone graduate. Determine whether it is possible. If it is possible, find the maximum number of students whose scores do not change during the process."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 3 \\times 10^5$\n*   $1 \\leq A_i,B_i \\leq 10^9\\,(1 \\leq i \\leq N)$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_N$ $B_N$"},{"iden":"sample input 1","content":"3\n1 2\n3 1\n3 3"},{"iden":"sample output 1","content":"1\n\nIf you swap scores of Student $1$ and $2$, everyone can graduate. Here, the number of students whose scores do not change is $1$ (only Student $3$)."},{"iden":"sample input 2","content":"2\n100 1\n100 1"},{"iden":"sample output 2","content":"2"},{"iden":"sample input 3","content":"6\n3 2\n1 6\n4 5\n1 3\n5 5\n9 8"},{"iden":"sample output 3","content":"\\-1"},{"iden":"sample input 4","content":"6\n3 1\n4 5\n5 2\n2 3\n5 4\n5 1"},{"iden":"sample output 4","content":"3"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}