#000490

BubbleOperations

You are given an array of n characters in the form of DSDSDS…DSD (n is odd) where D∈ {‘0’...’9’} and S ∈ {‘+’,’-‘,’=’,’>’,’<’}.

Find out the maximal number of non-overlapping correct expressions (a correct expression is a substring of the given string which starts and ends with a digit, has exactly one comparison operator (’=’ or ’>’ or ’<’), and is mathematically correct).



InputThe first line contains a positive integern (n is odd, and n<5,000,000). The next line consists of n characters in the form described above (without any spaces between characters).


OutputThe output consists of the integer number which represents the maximal number of non overlapping correct expressions.



Input:
7
7-5<3=5

Output:
1




Input:
11
2+5<6-4<5=3

Output:
2

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.