In the search for Planet B, scientists found an alternate reality. When they entered it, the scientists found themselves in an alternate version of Manhattan.
There are $$$N$$$ roads in this version of Manhattan, either an avenue (going North to South) or a street (going East to West), much like the original. In short, avenues are vertical lines, and streets are horizontal lines. No one has reached the end of a road, so assume that they go on infinitely in both directions.
Each time an avenue and a street intersect, there is an intersection. Find the number of intersections in the new Manhattan, given their unchanging coordinate (that would be $$$x$$$ coordinate for avenues, and $$$y$$$ coordinate for streets).
Word to the wise: it is possible that there are either no avenues or no streets. Also, no road is repeated in input.
Line $$$1$$$: $$$N$$$ ($$$1 \le N \le 10^3$$$), the total number of roads. They can be either avenues or streets.
Lines $$$2...N+1$$$: the letter $$$h$$$ or $$$v$$$, $$$h$$$ if the line is horizontal, and $$$v$$$ if the line is vertical. After that is the coordinate of the line $$$a_i$$$ ($$$-10^9 \le a_i \le 10^9$$$).
Line 1: The number of intersections
5 h 3 h 2 h 1 v 2 v 1
6
No lines will be given twice in the input.
| Название |
|---|


