#!/bin/python3 import math import os import random import re import sys n = int(input()) s = input() c=0 for i in range(0,n-3): if(s[i]=='D' and s[i+1]=='U' and s[i+2]=='D' and s[i+3]=='U'): c=c+1 print(c) # your code goes here