#include <bits/stdc++.h>
using namespace std;
const int N = 75 + 2;
const int INF = 1e9;
int n;
int freq[3];
int memo[N][N][N][2];
string s;
vector<int> ls[3];
int getCost(int a, int b, int c, int idx) {
  int res = 0;
  int j = 0;
  for (auto i : {a, b, c}) {
    for (int k = i; k < ls[j].size(); k++) {
      if (ls[j][k] < idx)
        res++;
      else
        break;
    }
    j++;
  }
  return res;
}
int dp(int a, int b, int c, bool v) {
  if (a >= ls[0].size() && b >= ls[1].size() && c >= ls[2].size()) return 0;
  if (memo[a][b][c][v] != -1) return memo[a][b][c][v];
  int ret = INF;
  if (a < ls[0].size())
    ret = min(ret, dp(a + 1, b, c, 1) + getCost(a, b, c, ls[0][a]));
  if (b < ls[1].size() && !v)
    ret = min(ret, dp(a, b + 1, c, 0) + getCost(a, b, c, ls[1][b]));
  if (c < ls[2].size())
    ret = min(ret, dp(a, b, c + 1, 0) + getCost(a, b, c, ls[2][c]));
  return memo[a][b][c][v] = ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'V')
      ls[0].push_back(i);
    else if (s[i] == 'K')
      ls[1].push_back(i);
    else
      ls[2].push_back(i);
  }
  memset(memo, -1, sizeof(memo));
  cout << dp(0, 0, 0, 0) << '\n';
  return 0;
}
