#include <bits/stdc++.h>
using namespace std;
int n;
int dp[80][80][80][2];
char s[80];
int sv[80], sk[80], so[80];
int pv[80], pk[80], po[80];
int nv, nk, no;
int main() {
  scanf("%d%s", &n, s);
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    sv[i + 1] = sv[i];
    sk[i + 1] = sk[i];
    so[i + 1] = so[i];
    if (s[i] == 'V')
      pv[nv++] = i, sv[i + 1]++;
    else if (s[i] == 'K')
      pk[nk++] = i, sk[i + 1]++;
    else
      po[no++] = i, so[i + 1]++;
  }
  for (int v = 0, ThxDem = nv + 1; v < ThxDem; ++v)
    for (int k = 0, ThxDem = nk + 1; k < ThxDem; ++k)
      for (int o = 0, ThxDem = no + 1; o < ThxDem; ++o)
        for (int i = 0, ThxDem = 2; i < ThxDem; ++i) dp[v][k][o][i] = 1 << 20;
  dp[0][0][0][0] = 0;
  for (int v = 0, ThxDem = nv + 1; v < ThxDem; ++v)
    for (int k = 0, ThxDem = nk + 1; k < ThxDem; ++k)
      for (int o = 0, ThxDem = no + 1; o < ThxDem; ++o)
        for (int i = 0, ThxDem = 2; i < ThxDem; ++i) {
          int z = dp[v][k][o][i];
          if (v < nv) {
            int r = z;
            int p = pv[v];
            r += max(sk[p] - k, 0) + max(so[p] - o, 0);
            dp[v + 1][k][o][1] = min(dp[v + 1][k][o][1], r);
          }
          if (k < nk && !i) {
            int r = z;
            int p = pk[k];
            r += max(sv[p] - v, 0) + max(so[p] - o, 0);
            dp[v][k + 1][o][0] = min(dp[v][k + 1][o][0], r);
          }
          if (o < no) {
            int r = z;
            int p = po[o];
            r += max(sk[p] - k, 0) + max(sv[p] - v, 0);
            dp[v][k][o + 1][0] = min(dp[v][k][o + 1][0], r);
          }
        }
  printf("%d\n", min(dp[nv][nk][no][0], dp[nv][nk][no][1]));
  return 0;
}
