#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000000000000 int main(){ int N; cin>>N; string S; cin>>S; int ans = 0; rep(i,S.size()){ if(S[i]!='M')continue; rep(j,S.size()){ if(i-j<0||i+j>=S.size())break; if(S[i-j]=='U'&&S[i+j]=='G')ans++; } } cout<