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 in = new Scanner(System.in); int n = in.nextInt(); String steps = in.nextLine(); steps = in.nextLine(); int numValley = 0; int alti = 0; int prevAlti = 0; for(int i = 0; i < n; i++){ prevAlti = alti; if(steps.charAt(i)=='D'){ alti--; } else{ alti++; } if(alti<0 && prevAlti == 0){ numValley++; } } System.out.println(numValley); } }