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 n = int.Parse(Console.ReadLine()); string path = Console.ReadLine(); int level = 0 ; int Valleys = 0 ; for(int i = 0 ; i < n; i++) { if(path[i] == 'U') { level++; if (level == 0) { Valleys++; } } else{ level--; } } Console.WriteLine(Valleys); } }