import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = in.next(); char hike[] = str.toCharArray(); int count = 0; int nivel = 0; for (char ss : hike) { if (ss == 'U') { nivel++; if (nivel == 0) { count++; } } if (ss == 'D') { nivel--; } } System.out.println(count); } }