#00002B

team

The Interpeninsular Olympiad in Informatics is coming and the leaders of the Balkan Peninsula Team have to choose the best contestants on the Balkans. Fortunately, the leaders could choose the members of the team among N very good contestants, numbered from 1 to N (3 <= N <= 500000). In order to select the best contestants the leaders organized three competitions. Each of the N contestants took part in all three competitions and there were no two contestants with equal results on any of the competitions. We say that contestant ? is better than another contestant ? when ? is ranked before ? in all of the competitions. A contestant A is said to be excellent if no other contestant is better than A. The leaders of the Balkan Peninsula Team would like to know the number of excellent contestants.<BR><BR>
Write a program named TEAM, which for given N and the three competitions results, computes the number of excellent contestants. <BR><BR>
The input data are given on the standard input as four lines. The first line contains the number N. The next three lines show the rankings for the three competitions. Each of these lines contains the identification numbers of the contestants, separated by single spaces, in the order of their ranking from first to last place. <BR><BR>
The standard output should contain one line with a single number written on it: the number of the excellent. <BR><BR>


EXAMPLE 1<BR><BR>

Input<BR>
3<BR>
2 3 1<BR>
3 1 2<BR>
1 2 3<BR><BR>

Output<BR>
3<BR><BR>

Note: No contestant is better than any other contestant, hence all three are excellent.

<BR><BR> EXAMPLE 2<BR><BR>

Input<BR><BR>
10 <BR>
2 5 3 8 10 7 1 6 9 4<BR>
1 2 3 4 5 6 7 8 9 10<BR>
3 8 7 10 5 4 1 2 6 9<BR><BR>
Output<BR>
4<BR><BR>

Note: The excellent contestants are those numbered with 1, 2, 3 and 5.


Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.