import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); int level = 0; int valleys = 0; String steps = scan.nextLine(); for(int i = 0; i < n; i++) { switch(steps.charAt(i)) { case 'D': if(level == 0) { valleys++; } level--; break; case 'U': level++; break; } } System.out.println(valleys); } }