#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
//freopen("in.txt","r",stdin);
int n;
cin>>n;
string str;
cin>>str;
int cnt=0;
for(int i=1;i<n;i++){
if(str[i]=='K'&&str[i-1]=='V'){
cnt++;
str[i]=str[i-1]==' ';
}
}
for(int i=1;i<n;i++){
if((str[i]=='V' && str[i-1]=='V')||(str[i]=='K'&& str[i-1]=='K')){
cnt++;
break;
}
}
cout<<cnt;
return 0;
}