#include using namespace std; int main() { long long walks; cin >> walks; long long counter = 0; long long valleys = 0; string s; cin >> s; for(int i = 0;i < s.length();i++) { if(s[i] == 'U'){ counter++; }else if(s[i] == 'D' && counter == 0){ counter--; valleys++;} else if(s[i] == 'D' && counter != 0){ counter--; } } cout << valleys; return 0; }