using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ int noOfSteps = Int32.Parse(Console.ReadLine()); string strSteps = Console.ReadLine(); int counterSteps = noOfSteps; int noOfVallies = 0; foreach (char s in strSteps) { int tempSteps = counterSteps; if(s == 'U') { counterSteps++; } if(s == 'D') { counterSteps--; } if (counterSteps == noOfSteps && tempSteps < noOfSteps) { noOfVallies++; } } Console.WriteLine(noOfVallies); } }