{"raw_statement":[{"iden":"problem statement","content":"Given are length-$N$ strings $S$ and $T$ consisting of `0` and `1`. You can do the following operation on $S$ any number of times:\n\n*   Choose $i$ ($2 \\leq i \\leq N$) such that $S_i=$`1`, and replace $S_i$ with `0`. Additionally, invert $S_{i-1}$, that is, change it to `1` if it is `0` now and vice versa.\n\nIs it possible to make $S$ exactly match $T$? If it is possible, how many operations does it take at least?"},{"iden":"constraints","content":"*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $S$ is a string of length $N$ consisting of `0` and `1`.\n*   $T$ is a string of length $N$ consisting of `0` and `1`."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$S$\n$T$"},{"iden":"sample input 1","content":"3\n001\n100"},{"iden":"sample output 1","content":"2\n\nWe can do as follows: `001` → (choose $i=3$) → `010` → (choose $i=2$) → `100`."},{"iden":"sample input 2","content":"3\n001\n110"},{"iden":"sample output 2","content":"\\-1"},{"iden":"sample input 3","content":"5\n10111\n01010"},{"iden":"sample output 3","content":"5"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}