using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CountingValleys { class Program { static void Main(string[] args) { int n = Convert.ToInt32(Console.ReadLine()); char[] s = Console.ReadLine().ToCharArray(); int countu = 0; int countd = 0; int countv = 0; for(int i = 0; i < n; i++) { if(s[i].Equals('U')) { countu++; } else { countd++; } if((countd == countu) && s[i].Equals('U')) { countv++; countu = 0; countd = 0; } else if((countd == countu) && s[i].Equals('D')) { countu = 0; countd = 0; } } Console.WriteLine(countv); } } }