B. Overtaking
time limit per test
5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Two athletes run a long-distance race, but the race is different from usual athletics events. They run for a predetermined duration, and the one who runs longer will be the winner. At every minute after the start, the distances both runners ran in the previous one minute are recorded. You are expected to write a program that, given the record of a race, counts the number of overtakings by either runner during the race. You should assume that both runners keep constant paces for every one minute before their distances are recorded.

Here, the term overtaking stands for the event where the runner previously behind takes the lead. Note that, before overtaking, the two runners may run side by side for a while, during which neither takes the lead. Figure B-1 shows the times and the positions of two runners for the third dataset of Sample Input. The number of overtakings in this case is two.

Figure B-1: The first dataset of Sample Input
Input

The input consists of multiple datasets, each in the following format.

$$$n$$$
$$$a_1$$$ $$$\ldots$$$ $$$a_n$$$
$$$b_1$$$ $$$\ldots$$$ $$$b_n$$$

$$$n$$$ is an integer between $$$2$$$ and $$$1000$$$, inclusive. It represents the duration of the race in minutes. Each of $$$a_k$$$ ($$$k = 1, \ldots, n$$$) is an integer between $$$1$$$ and $$$1000$$$, inclusive. It represents the distance the first runner ran between $$$k − 1$$$ minutes and $$$k$$$ minutes after the start of the race, in meters. Similarly, $$$b_k$$$ ($$$k = 1, \ldots, n$$$) represent the distances the second runner ran.

The end of the input is indicated by a line consisting of a zero. The number of datasets does not exceed $$$100$$$.

Output

For each dataset, output the number of overtakings on a line.

Example
Input
3
5 15 5
10 5 15
9
10 10 10 10 10 10 10 10 10
5 15 10 5 15 10 5 15 10
9
10 10 10 5 15 10 10 10 10
5 15 10 10 10 10 5 15 10
0
Output
2
0
2