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) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); int n = in.nextInt(); int currlevel = 0; int numOfV = 0; String nC = in.next(); for (int i = 0; i < n; i++){ if (currlevel == 0 && nC.charAt(i) == 'D') { numOfV = numOfV + 1; } if (nC.charAt(i) == 'D') { currlevel = currlevel -1; } else if (nC.charAt(i) == 'U') { currlevel = currlevel +1; } } System.out.println(numOfV); } }