#ABC243B. [ABC243B] Hit and Blow

[ABC243B] Hit and Blow

Score : 200200 points

Problem Statement

You are given integer sequences, each of length NN: A=(A1,A2,,AN)A = (A_1, A_2, \dots, A_N) and B=(B1,B2,,BN)B = (B_1, B_2, \dots, B_N). All elements of AA are different. All elements of BB are different, too.

Print the following two values.

  1. The number of integers contained in both AA and BB, appearing at the same position in the two sequences. In other words, the number of integers ii such that Ai=BiA_i = B_i.
  2. The number of integers contained in both AA and BB, appearing at different positions in the two sequences. In other words, the number of pairs of integers (i,j)(i, j) such that Ai=BjA_i = B_j and iji \neq j.

Constraints

  • 1N10001 \leq N \leq 1000
  • 1Ai1091 \leq A_i \leq 10^9
  • 1Bi1091 \leq B_i \leq 10^9
  • A1,A2,,ANA_1, A_2, \dots, A_N are all different.
  • B1,B2,,BNB_1, B_2, \dots, B_N are all different.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

B1B_1 B2B_2 \dots BNB_N

Output

Print the answers in two lines: the answer to1. in the first line, and the answer to2. in the second line.

4
1 3 5 2
2 3 1 4
1
2

There is one integer contained in both AA and BB, appearing at the same position in the two sequences: A2=B2=3A_2 = B_2 = 3. There are two integers contained in both AA and BB, appearing at different positions in the two sequences: A1=B3=1A_1 = B_3 = 1 and A4=B1=2A_4 = B_1 = 2.

3
1 2 3
4 5 6
0
0

In both 1. and 2., no integer satisfies the condition.

7
4 8 1 7 9 5 6
3 5 1 7 8 2 6
3
2