#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
ll ans;
int n;
string a;
int c,o,w;//o代表前面有几个co
int main()
{
cin>>n>>a;
for(int i=0;a[i];i++)
{
if(a[i]=='C') c++;
else if(a[i]=='O') o+=c;
else ans+=o;//有几个co就有几个cow
}
cout<<ans;
return 0;
}
01-25
228
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-08
251
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-17
722
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-28
1379
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-16
4672
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)