import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int count = scanner.nextInt(); String line = scanner.next(); scanner.close(); int numOfValley = 0; int numOfM = 0; int sum = 0; for(int i=0; i