#include<bits/stdc++.h>
#include<utility>
using namespace std;
string s;
long long cnt_c=0,cnt_o=0,cnt_w=0;
int n=0;
int main()
{
cin>>n;
cin>>s;
for(auto i:s)
{
if(i=='c') cnt_c++;
else if(i=='o') cnt_o+=cnt_c;
else cnt_w+=cnt_o;
}
cout<<cnt_w;
return 0;
}