Competition
InterviewTime limit1sMemory limit256 MB
Find the fewest seat changes that let Alice and Bob solve every solvable problem in contest order.
Problem
Bob and Alice enter a programming contest as a team.
The contest has problems, and the two go through them in order from problem 1 to problem . A problem that neither of them can solve is skipped. Some problems only Alice can solve, and some only Bob can solve.
Whoever is sitting at the computer solves the problem. The two want to solve every problem they are able to solve while changing who sits at the computer as few times as possible. Either person can start at the computer.
Given the number of problems and the problems each of them can solve, find the minimum number of changes.
Input
The first line contains three integers , , and (, , ).
The second line contains the problem numbers Alice can solve. The third line contains the problem numbers Bob can solve. Within one line the numbers are distinct and lie between 1 and , and they are not necessarily sorted.
Output
Print the minimum number of changes at the computer.