#include <bits/stdc++.h>
using namespace ::std;
const int maxn = 75 + 2;
const int inf = 0x3f3f3f3f;
int dp[maxn][maxn][maxn][2], sumv[maxn], sumk[maxn], sumx[maxn], n;
vector<int> v, k, x;
char s[maxn];
int cnt(int i, int j, int p, int pos) {
  int ret = 0;
  while (i < v.size() && v[i] < pos) ret++, i++;
  while (j < k.size() && k[j] < pos) ret++, j++;
  while (p < x.size() && x[p] < pos) ret++, p++;
  return ret;
}
void solve() {
  scanf("%d%s", &n, s);
  v.clear();
  k.clear();
  x.clear();
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'V')
      v.push_back(i), sumv[i]++;
    else if (s[i] == 'K')
      k.push_back(i), sumk[i]++;
    else
      x.push_back(i), sumx[i]++;
    if (i == 0) continue;
    sumv[i] += sumv[i - 1];
    sumk[i] += sumk[i - 1];
    sumx[i] += sumx[i - 1];
  }
  for (int i = 0; i <= v.size(); i++) {
    for (int j = 0; j <= k.size(); j++) {
      for (int p = 0; p <= x.size(); p++) {
        for (int t = 0; t < 2; t++) {
          if (i < v.size())
            dp[i + 1][j][p][1] =
                min(dp[i + 1][j][p][1], dp[i][j][p][t] + cnt(i, j, p, v[i]));
          if (j < k.size() && t == 0)
            dp[i][j + 1][p][0] =
                min(dp[i][j + 1][p][0], dp[i][j][p][t] + cnt(i, j, p, k[j]));
          if (p < x.size())
            dp[i][j][p + 1][0] =
                min(dp[i][j][p + 1][0], dp[i][j][p][t] + cnt(i, j, p, x[p]));
        }
      }
    }
  }
  int ans = min(dp[v.size()][k.size()][x.size()][0],
                dp[v.size()][k.size()][x.size()][1]);
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
