{"raw_statement":[{"iden":"problem statement","content":"You are given multisets with $N$ non-negative integers each: $A={ a_1,\\ldots,a_N }$ and $B={ b_1,\\ldots,b_N }$.  \nYou can perform the operations below any number of times in any order.\n\n*   Choose a non-negative integer $x$ in $A$. Delete one instance of $x$ from $A$ and add one instance of $2x$ instead.\n*   Choose a non-negative integer $x$ in $A$. Delete one instance of $x$ from $A$ and add one instance of $\\left\\lfloor \\frac{x}{2} \\right\\rfloor$ instead. ($\\lfloor x \\rfloor$ is the greatest integer not exceeding $x$.)\n\nYour objective is to make $A$ and $B$ equal (as multisets).  \nDetermine whether it is achievable, and find the minimum number of operations needed to achieve it if it is achievable."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 10^5$\n*   $0 \\leq a_1 \\leq \\ldots \\leq a_N \\leq 10^9$\n*   $0 \\leq b_1 \\leq \\ldots \\leq b_N \\leq 10^9$\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$ $\\ldots$ $a_N$\n$b_1$ $\\ldots$ $b_N$"},{"iden":"sample input 1","content":"3\n3 4 5\n2 4 6"},{"iden":"sample output 1","content":"2\n\nYou can achieve the objective in two operations as follows.\n\n*   Choose $x=3$ to delete one instance of $x\\, (=3)$ from $A$ and add one instance of $2x\\, (=6)$ instead. Now we have $A={4,5,6}$.\n*   Choose $x=5$ to delete one instance of $x\\, (=5)$ from $A$ and add one instance of $\\left\\lfloor \\frac{x}{2} \\right\\rfloor \\, (=2)$ instead. Now we have $A={2,4,6}$."},{"iden":"sample input 2","content":"1\n0\n1"},{"iden":"sample output 2","content":"\\-1\n\nYou cannot turn ${ 0 }$ into ${ 1 } $ ."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}