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 stepcount = in.nextInt(); in.nextLine(); String steps = in.nextLine(); boolean newSeaLevel = false; int countSeaLevel = 0; steps = steps.toUpperCase(); int countVally = 0; int finalVally = 0; for(int i = 0; i < stepcount; i++) { if(countSeaLevel == 0){ if(steps.charAt(i) == 'D'){ newSeaLevel = true; } if(newSeaLevel){ countVally++; newSeaLevel = false; } } if(steps.charAt(i) == 'D') countSeaLevel -= 1; else countSeaLevel += 1; } System.out.println(countVally); } }