Difference
Time limit2sMemory limit1024 MB
Given two sequences A and B and an integer K, count the pairs (p, q) where A_p + K equals B_q.
Problem
You are given an integer , an integer sequence of length , and an integer sequence of length .
Count the pairs of integers that satisfy all of the following conditions.
- .
- .
- .
Input
The input is given in the following format.
K
N
A1 A2 … AN
M
B1 B2 … BM
Output
Print the number of pairs that satisfy all the conditions.
Print only the answer. Do not print any prompt or other text.
Constraints
- .
- .
- .
- ().
- ().
- All input values are integers.