#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; cin>>n; int cloc=0; int vally_count=0; int sh=0; for(int i=0;i>step; if(step=='U') cloc++; if(step=='D') cloc--; if(cloc==0) { if(sh<0) vally_count++; } sh=cloc; } cout<