#include #include #include #include #include using namespace std; using namespace std; int totalheight(std::vector& v) { int height=0; int valley=0; bool valleyflag=false; for (std::vector::iterator it = v.begin();it!=v.end();++it) { if (*it=='D') { --height; } if (*it=='U') { ++height; } if(height<0 &&valleyflag==false) { ++valley; valleyflag=true; } else if(height==0) { valleyflag=false; } } return valley; } int main(){ int n; cin >> n; vector steps(n); for(int i = 0;i < n;i++) { cin >> steps[i]; } cout<