import java.io.*; import java.util.*; public class Solution { 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 scan = new Scanner(System.in); int n = scan.nextInt(); String arr = scan.next(); int total = 0; int counter = 0; boolean isValley = true; String sub = ""; for(int i = 0; i < arr.length(); i++){ sub = arr.substring(i, i + 1); if(sub.equals("D")){ total--; } if(sub.equals("U")){ total++; if(total == 0){ counter++; } } } System.out.println(counter); } }