#include <bits/stdc++.h>
const int N = 80;
int dp[N][N][N][2], pos[3][N], use[3], cnt[3], n;
char s[N];
void Min(int &x, int y) {
  if (y < x) x = y;
}
int cal(int x) {
  int sum = 0;
  for (int i = 0; i <= 2; i++)
    for (int j = use[i] + 1; pos[i][j] < x && j <= cnt[i]; j++) sum++;
  return sum;
}
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'V')
      pos[0][++cnt[0]] = i;
    else if (s[i] == 'K')
      pos[1][++cnt[1]] = i;
    else
      pos[2][++cnt[2]] = i;
  }
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int v = 0; v <= cnt[0]; v++, use[0]++)
    for (int k = 0; k <= cnt[1]; k++) {
      use[1] = k;
      for (int i = 0; i <= cnt[2]; i++) {
        use[2] = i;
        for (int t = 0; t <= 1; t++) {
          int ret = dp[v][k][i][t];
          if (v < cnt[0]) Min(dp[v + 1][k][i][1], ret + cal(pos[0][v + 1]));
          if (k < cnt[1] && t != 1)
            Min(dp[v][k + 1][i][0], ret + cal(pos[1][k + 1]));
          if (i < cnt[2]) Min(dp[v][k][i + 1][0], ret + cal(pos[2][i + 1]));
        }
      }
    }
  printf("%d\n", std::min(dp[cnt[0]][cnt[1]][cnt[2]][0],
                          dp[cnt[0]][cnt[1]][cnt[2]][1]));
}
