An image consists of black and white only can be compressed using quad-tree.

Company OO is going to play number game by dividing 2xN employees into two teams of N player. Let call each team as A and B. The rule of number game is as follows.

  • First of all, all employees are given a random natural number.
  • Each employee plays the game only once.
  • In each game, one employee on both A and B team each open their number. The employee with a higher number is determined a winner and the team where the employee belongs get 1 point.
  • If the number of both employees are the same, no team gets point.

First, all employees were given a random natural number. And then team A decided the play order quickly, and revealed it to team B. Based on the play order of team A, beam B determined their play order to maximize the total point. At this point, calculate the total point team B will get.
Given an array A containing numbers assigned to employees of team A in order of play and an array B whose i-th element represents number given to i-th employee of team B, write a function solution to return the maximum point that team B can get.

  • A and B have the same length.
  • Length of A and B is between 1 and 100,000.
  • Each element of A and B is natural number less than 1,000,000,000.
A B result
[5,1,3,7] [2,2,6,8] 3
[2,2,2,2] [1,1,1,1] 0

Example #1
In team A, an employee with number 5 plays the game first, then ones with numbers 1, 3, and 7 play the game in turn.
In team B, when 4th, 2nd, 3rd, and 1st employees play the game in turn, numbers given to them are 8, 2, 6, and 2, in turn. Then, team B gets 3 points by winning the first, second, and third game. This is the total point.

Example #2
Team B always gets 0 points regardless of the play order.

Result Stop
Result of [Run Test] or [Submit] will be displayed here