1. You are given a number N and two sorted matrices(A and B) of N*N dimensions. 2. You are also given a number X. 3. You have to find the count of all valid pairs from matrices whose sum is equal to X. 4. A pair is called valid if one element of the pair is selected from A and the second element is selected from B.
Input Format
A number N A1 A2.. N*N numbers B1 B2.. N*N numbers
Output Format
A number representing the count of all valid pairs.
Constraints
1 <= N <= 10^3 -10^3 <= elements of matrices <= 10^3
Example
Input
3 1 5 6 8 10 11 15 16 18 2 4 7 9 10 12 13 16 20 21
Output
4