#include #include #include #include #include using namespace std; int main() { long t; cin >> t; long cnt = 0; long cnt_d = 0; while (t--) { char inp; cin >> inp; if (cnt == 0 && inp == 'D') ++cnt_d; if (inp == 'U') ++cnt; else if (inp == 'D') --cnt; } cout << cnt_d << endl; return 0; }