#include<iostream>
using namespace std;
string str;
int x,n;
int main(){
cin>>n;
cin>>str;
int f=1;
for(int i=0;i<n-1;i++){
if(str[i]=='V'&&str[i+1]=='K'){
x++;
}else if(str[i]=='V'&&f!=0){
x++;
str[i+1]='K';
f=0;
}else if(i!=0&&str[i-1]!='V'&&str[i]=='K'&&f!=0){
x++;
str[i-1]='V';
f=0;
}
}
cout<<x;
return 0;
}