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 sc=new Scanner(System.in); int steps =sc.nextInt(); String b=sc.nextLine(); b=sc.nextLine(); int h = 0; int res = 0; for(int i = 0; i<steps; i++){ char s = b.charAt(i); if(s == 'U'){ h++; if(h == 0){res++;} }else{ h--; } } System.out.println(res); } }