#include using namespace std; int main() { int n; cin >> n; char step; int height = 0; int valleys = 0; for (int i=0;i> step; if (step=='U'){ height++; if (height == 0){ valleys++; } } else if (step=='D'){ height--; } } cout << valleys; return 0; }