Author: | M. Sporyshev | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Young programmer Vasya came back home from an internship in a large IT company. As a souvenir, he brought back a band with a sequence of M natural numbers embroiled on it.
Vasya does not care much about numbers, so he wants to gift a band to a friend. However, each one of M Vasya's friends has exactly one number he strongly dislikes, and so would not want a band containing that number as a gift. All numbers disliked by Vasya's friends are different.
In order to still make a gift out of the band, Vasya wants to cut it in such a way, that every piece of the band could be given to at least one of his friends (several pieces may go to the same friend).
Your program must determine minimal number of cuts Vasya must perform to be able to give all pieces as gifts.
First line of input file contains integer N — count of numbers on the band.
Second line of input file contains N integers ai — a sequence of numbers on the band.
Third line of input file contains integer M — number of Vasya's friends.
Fourth line of input file contains M integers bi — disliked number of i-th friend. All bi are different.
Output file must contain a single integer — minimal number of band cuts.
1 ≤ N ≤ 105
2 ≤ M ≤ 105
1 ≤ ai, bi ≤ 109
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|