#include using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); int n; string s; cin>>n>>s; int cnt=0; rep(i,n){ rep2(j,i+1,n){ if(s[i]=='U'){ if(s[j]=='M'){ if(j*2-i>=0&&j*2-i