import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public enum State{Valley,SeaLevel,Mt}; public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner s = new Scanner(System.in); int numSteps = s.nextInt(); String steps = s.next(); State state = State.SeaLevel; int seaLv = 0; //if sealevel>0 -> mountain; if sealevel<0 valley int numValley = 0; for(int i=0; i0){ state = State.Mt; }else if(seaLv<0){ state = State.Valley; }else{ } break; case Mt: if(seaLv == 0){ state = State.SeaLevel; } break; default: return; } } System.out.println(numValley); } }