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); String t = in.nextLine(); String s = in.nextLine(); char [] ch = s.toCharArray(); int l = 0; int v = 0; for(int i=0 ;i < ch.length; i++){ if(ch[i] == 'U'){ l++; if(l == 0) v++; } if(ch[i] == 'D'){ l--; } } System.out.println(v); } }