Олимпиадный тренинг

Задача 42324. Find and count


Given two integer sequences, each of length NA = (A1, A 2, ..., AN) and B = (B1, B2, ..., BN).
All A elements are different. All B elements are also different.

Print the following two values.

  1. The number of integers contained in both and B appearing in the same position in the two sequences. In other words, the number of integers  i numbers such that A= Bi.
  2. The number of integers contained in both and B that appear at different positions in the two sequences. In other words, the number of pairs of integers  (i, j) numbers such that A= Band i ≠ j.


Input
The program receives three lines as input. The first line contains one number N (1 <= N <= 1000) - the number of numbers in the sequence. The second line contains numbers A1, A2, ..., AN, all numbers are different . The third line contains numbers B1, B2, ..., B, all numbers various (1 <= Ai, Bi <= 109). 

Imprint
Print the answer to the first question on the first line, and the answer to the second on the second line.
 
 
Examples
# Input Output
1
4
1 3 5 2
2 3 1 4
1
2
2
3
1 2 3
4 5 6
0
0