#include #include #include #include #include using namespace std; int main() { int N; cin >> N; int pos = 0; int valleys = 0; for (int i = 0; i < N; i++) { char input; cin >> input; if (input == 'D') { pos--; } else { if (pos == -1) { valleys++; } pos++; } } cout << valleys << "\n"; return 0; }