Finally Monster Hunter Wilds has released and Sebastian has been playing non stop since then. On Monster Hunter you go on hunts to kill a monster and gather its materials. There are many kind of weapons you can use in Monster Hunter, and Wilds now allows you to use a principal weapon and a secondary weapon in each hunt!
Sebastian has been keeping a log of how many times he has used each weapon as his main one, and how many times he has used it as his secondary, but due to being too distracted playing he might have made some mistakes. He has asked you to help him figure it out, while he keeps playing.
Given the list of logs describing how many times each weapon has been used as main and as secondary, decide if it's possible to have gotten these values given that in each mission a primary and a secondary weapon were used, and they were different. If it's impossible to have a valid assignment from the logs, compute the least amount of changes needed to make it a viable list. A change is considered as either increasing or decreasing any number in the list by one.
On the first line a number $$$N$$$ ($$$2\leq N \leq 10^6$$$) - the number of weapons.
On the next $$$N$$$ lines, two numbers $$$a_i$$$ and $$$b_i$$$ ($$$0\leq a_i, b_i\leq 10^6$$$) - the number of times the $$$i$$$-th weapon was used as primary and secondary, respectively.
An integer, $$$0$$$ in case the list already provides a possible assignment, otherwise the number of changes necessary to make it a viable list.
31 11 11 1
0
21 01 0
2
"By order of the guild, hunt this problem"
| Name |
|---|


