#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ long long int n,i; char inp; cin >> n; long long int stepcount=0, valcount=0; for(i=0; i> inp; if(inp == 'D') stepcount--; if(inp == 'U'){ if(stepcount == -1) valcount++; stepcount++; } } cout<