N recruits are standing in front of a sergeant who orders to turn left. Some of the soldiers turn left, while the others turn right. In a second each recruit seeing the face of another recruit understands that a mistake was made and turns around. This happens at the same time to each pair of soldiers facing each other. The process continues until the formation becomes stable. Write a program, which finds out the number of times when a pair of soldiers turned around. If the process is infinite then the program should write the word “NO”.
Example:
Legend:
‘<’: a recruit facing left;
‘>’: a recruit facing right.
 | Formation | 
 Comments | 
 Number of turns | 
 | > > < < > < | 
 Initial formation | 
 2 | 
 | > < > < < > | 
 One second has passed | 
 2 | 
 | < > < > < > | 
 Two seconds have passed | 
 2 | 
 | < < > < > > | 
 Three seconds have passed | 
 1 | 
 | < < < > > > | 
 Final formation | 
 Total: 7 | 
 Input
The first line contains the number of recruits (N). The rest of the input contains only ‘<’, ‘>’ and line break characters. There is exactly N ‘<’ and ‘>’ characters in the input. Each line of the input may have up to 255 characters.
 
1 ≤ N ≤ 30000.
Output
Write the number of turns.
Sample
Problem Source: Quarterfinal, Central region of Russia, Rybinsk, October 17-18 2001