cho.sh
Notes
Loading...

Duel

Time limit

2s

Memory limit

128 MB

Problem

Team A and Team B will play one-on-one duels. Each team has N people, and every person must be matched with exactly one person from the other team.

In a duel, the person with the higher ability wins. If Team A's person wins, Team A earns 2 points. If the two abilities are equal, Team A earns 1 point. If Team A's person loses, Team A earns no points.

Team A's abilities are A1, A2, ..., AN, and Team B's abilities are B1, B2, ..., BN. Choose the matchups to maximize Team A's total score, and output that maximum score.

Input

The first line contains N, the number of people on each team.

The second line contains Team A's abilities A1, A2, ..., AN.

The third line contains Team B's abilities B1, B2, ..., BN.

Output

Output the maximum score Team A can earn.

Constraints

  • 1 <= N <= 50
  • 1 <= Ai, Bi <= 1,000