In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
Elections are coming and the mayor of Bytetown decided to organize an athletic competition to increase his odds. Unfortunately there is no athletic stadium in Bytetown, so all parts of the competition will have to be held in the streets. The mayor decided to limit the competition only to running events and asked you for help with planning the troutes.
There are street junctions and streets in Bytetown. The streets can be used to travel between any pair of junctions. Every route must start at a junction, lead along several streets and finish at some other junction. The mayor would like to organize as many events simultaneously as possible, so the number of routes should be as large as possible. Due to safety reasons no two routes may have a common junction or street. Moreover not every junction can be used as a starting or ending point of a race.
The first line of the input contains a single integer (): the number of junctions in Bytetown. The junctions are numbered from to . The following lines contain descriptions of the streets; each of them consists of two integers and (, ), separated by a single space: the numbers of junctions that are endpoints of the street.
The line number contains one integer (): the number of junctions that can serve as a starting or ending point of a race. The last line of the input contains distinct space-separated numbers: the numbers of those junctions, each in the range .
The first and only line of the output should contain one integer, the maximal possible number of running events that can be held in Bytetown simultaneously.
For the input data:
5 1 2 3 2 4 1 1 5 4 1 2 5 4
the correct result is:
Task author: Tomasz Idziaszek.