eolymp
bolt
Try our new interface for solving problems

Trams

Government small town Muholovska decided to improve the transport situation in the city. For this was built a network of tram lines, connecting \textbf{n} tram stops. For the convenience of passengers between each pair of stops could ride the tram. On the other hand, in order to save, to pass between two stops can be a unique way. Formally speaking, the tram network is a tree with \textbf{n} vertices. In this case, the top of the tree correspond to the stops, and edges - waterways. Initially, for each tram road passed at least one tram route. Over time, however, some routes were canceled, and, consequently, some tram lines were unclaimed. The path is considered unclaimed if no one tram route on it does not pass. To save money, unclaimed tramways Muholovska it was decided to disassemble. Your task - to write a program to determine the number of unclaimed tract. \includegraphics{https://static.e-olymp.com/content/1b/1b6a6c4b2fe21576d8d9b7f60888166f9d68ba04.jpg} Illustration to the second example. The dotted line represents the unused path. \InputFile The first line contains a unique number \textbf{n} - the number of trams of the city (\textbf{2} ≤ \textbf{n} ≤ \textbf{100000}). Each of the following (\textbf{n-1})-th row contains the description of a tram rails (edges of the tree). Description consists of two numbers \textbf{b} and \textbf{e} - number of stops that are connected by appropriate. Stops are numbered by integers from \textbf{1} to \textbf{n}. The next line contains the number \textbf{m} - number of tram lines (\textbf{0} ≤ \textbf{m} ≤ \textbf{100000}). In each of the following \textbf{m} lines contains a description of the tram route. Description consists of two numbers \textbf{x} and \textbf{y} - the tram route is the final stop with the numbers \textbf{x} and \textbf{y} and passes through the shortest path between them (\textbf{x} ≠ \textbf{y}). \OutputFile The output file output the number of unclaimed tramway Muholovska.
Time limit 5 seconds
Memory limit 64 MiB
Input example #1
4
1 2
1 3
1 4
0
Output example #1
3