#include #include #include #include #include using namespace std; int main() { int n; cin >> n; string s; cin >> s; int level = 0, ans = 0; for (int i = 0; i < n; ++i) { if (level == 0 && s[i] == 'D') ++ans; if (s[i] == 'D') --level; else ++level; } cout << ans << endl; return 0; }