Ball momentum#234

Ball momentum

1 second
256 megabytes
Medium

There are baseball balls and machines for serving them. Each ball has its weight w_i and each machine has its power of serving p_i. We can choose a ball and machine to serve it. Let's say that difficulty of catching -th ball served using machine is w_i \times p_j. You want to pick a pair () such that any other pair (i';j') (i \neq i' and j \neq j') has difficulty of catching less or equal to the difficulty of catching the pair(). Tell the number of such pairs.

Input

The first line of input contains a single integer (1 \le n \le 2 \cdot 10^5) — number of balls and serving machines.

The second line of input contains integers w_i (1 \le w_i \le 10^9) — weitghts of balls.

The third line of input contains integers p_i (1 \le p_i \le 10^9) — powers of serving machines.

Output

Print one integer — answer to the problem.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Scoring

  1. ( points): n \le 3;

  2. ( points): all w_i are equal and all p_i are equal;

  3. ( points): all w_i are equal;

  4. ( points): w_i,p_i \le 1000;

  5. ( points): n \le 100

  6. ( points): n \le 1000

  7. ( points): no additional restrictions.