Flipkart | Online Assessment
Anonymous User
306

A network company wants to establish a network park to reduce the noise of different network operators. In the network park, different operators will set up their sender antenna, or receiver antenna, or both. The sender antenna and receiver antenna are represented by two lists of size and respectively. These antennas will only receive/send to their respective sender/receiver antenna, but doing this process will retain some noise. Noise is a result of a crossed signal i.e., a signal in which the signal of one network operator is overlapped by the signal of the other network operator. Now the network company wants to know the maximum numbers of networks that will be noiseless.

Write an algorithm to find the maximum number of networks that will be noiseless.

Input

The first line of the input consists of an integer - sender_size, representing the total number of sender antennas.
The next line consists of space-separated integers, representing sender antennas ().
The next line consists of an integer - receiver_size, representing the total number of receiver antennas ().
The next line consists of space-separated integers, representing receiver antennas.

Output

Print an integer representing the maximum number of networks that will be noiseless.

Example

Input:

3
7 8 5
3
7 5 8
Output:

2
Explanation:

7 8 5  (Sender Antennas)
|  \
|   \
7 5  8  (Receiver Antennas)

2 uncrossed signals can be drawn as in the diagram.

3 uncrossed signals cannot be drawn, because the signal from 8 of the sender to 8 of the receiver antenna will intersect/cross the signal from 5 of the sender to 5 of the receiver antenna.

Comments (2)