There are clowns, pairs of shoes, and shoe colours. Each clown has a favourite shoe colour . Each clown also has a shoe size , and can only wear shoes with size . Assuming every clown must be given a pair of shoes that they can wear, how many can get their favourite colour?
Input Specification
The first line will contain two integers and .
The next lines will contain integers and , the colour and size of the shoe respectively.
The next lines will contain integers and , the favourite colour and shoe size of the clown respectively.
It is guaranteed that it is possible to distribute the shoes among the clowns such that each clown is given a pair of shoes that they can wear.
Output Specification
On one line you are to output one integer, the number of clowns who can wear shoes of their favourite color in a valid distribution.
Subtasks
Subtask 1 (5%)
Subtask 2 (20%)
Subtask 3 (75%)
No further constraints.
Sample Input
3 9
3 3
3 9
2 4
2 3
1 5
3 4
Sample Output
0
Comments