Jenny has been using Beli to catalog her favorite places in San Francisco! For those who don't know, Beli can be used to rank restaurants. Beli asks the user to rate a restaurant first by whether they liked it, thought it was fine, or didn't like it, and then beyond that asks the user to stack-rank all restaurants within the initial three categories.
While browsing Beli, Jenny has stumbled upon a profile by someone named Jeni that has conveniently ranked exactly the same set of restaurants she has. Jenny is curious how similar their tastes are - specifically, the total number of restaurants that the two of them rated in the same category. Beli does not easily expose this functionality though, so it's your job to compute this!
Constraints
Subtask 1 [1 point]
Subtask 2 [1 point]
No additional constraints.
Input Specification
The first line will contain a single integer, .
The next three lines summarize Jenny's Beli ratings. The three lines after that summarize Jeni's Beli ratings.
A summary of a given's user ratings uses exactly three lines. The first line describes the restaurants the user liked.
The second line describes the restaurants the user thought was fine. The third line describes the restaurants
the user didn't like. The description of restaurants within a single category always takes the form of an integer ,
followed by
distinct integers from
to
, indicating in order from best-to-worst within the category, the
restaurants as rated by the user.
Each restaurant is assigned a unique integer from to
, and it is guaranteed that each integer appears in exactly
one category for both users.
Output Specification
Output a single integer, the number of restaurants that both Jenny and Jeni rated in the same category.
Sample Input 1
4
1 1
2 4 2
1 3
2 1 2
2 3 4
0
Sample Output 1
2
Sample Explanation 1
The users both liked restaurant and thought restaurant
was fine. Therefore, the answer is
.
Comments