Jaiden's Maidens


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python, Rust

Jaiden has decided he would like to treat himself by buying a boat. Infact, he has decided that he'll buy several of them.

A common tradition for a boat's maiden voyage is to smash a bottle of champange or wine over the bow, which Jaiden has decided to participate in. However, Jaiden needs to be careful as if the bottle fails to break it is considered a bad omen.

Jaiden has several bottles which he will have to smash against the boats. Each boat has a hardness value h. Each bottle has a brittleness value b. The boats are in a fixed order, but bottles that are thrown at each boat are selected by Jaiden. He must only throw a single bottle at a given boat, and cannot opt to skip a boat. If it is not possible to successfully break a bottle on the boat Jaiden is currently at, he will stop and not further attempts will be made.

On a given throw of a bottle with brittleness value b_i, on a boat with hardness h_i, the bottle will break if b_i \geq h_i.

What is the maximum number of bottles Jaiden can successfully break?

Input

The first line consists of a single integer n (1 \leq n \leq 5\times 10^{5}), the number of boats and bottles of champange.

The next line consists of n space separated integers h_1, h_2, \dots, h_n (1 \leq h_i \leq 10^{5}), the hardness value of the i_{th} boat.

The next line consists of n space separated integers b_1, b_2, \dots, b_n (1 \leq b_i \leq 10^{5}), the brittleness value of the i_{th} bottle of champange.

Output

Output a single integer, the maximum number bottles Jaiden can successfully break.

Examples

Input 1
5
7 2 9 3 3
2 4 6 8 10
Output 1
5
Input 2
3
1 2 100
2 1 1
Output 2
2

Comments

There are no comments at the moment.