#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int oo = 0x3f3f3f3f;
int N, f[MAXN][MAXN][MAXN][2], cnt[MAXN];
char s[MAXN];
namespace solution {
int col(int x, int y, int z, int t) {
  int pos, res = 0;
  for (int i = 1; i <= N; i++) cnt[i] = 1;
  for (int i = 1; i <= N; i++) {
    if (s[i] == 'V' && x) {
      cnt[i] = 0;
      x--;
      if (x == 0 && t == 0) pos = i;
    }
    if (s[i] == 'K' && y) {
      cnt[i] = 0;
      y--;
      if (y == 0 && t == 1) pos = i;
    }
    if (s[i] != 'V' && s[i] != 'K' && z) {
      cnt[i] = 0;
      z--;
      if (z == 0 && t == 2) pos = i;
    }
  }
  for (int i = 1; i <= pos; i++) res += cnt[i];
  return res;
}
void Prepare() { scanf("%d%s", &N, s + 1); }
void Solve() {
  memset(f, 10, sizeof(f));
  f[0][0][0][0] = 0;
  int r1 = 0, r2 = 0, r3 = 0;
  for (int i = 1; i <= N; i++) {
    if (s[i] == 'V')
      r1++;
    else if (s[i] == 'K')
      r2++;
    else
      r3++;
  }
  for (int i = 0; i <= r1; i++)
    for (int j = 0; j <= r2; j++)
      for (int k = 0; k <= r3; k++) {
        if (i) {
          f[i][j][k][1] =
              min(f[i][j][k][1], f[i - 1][j][k][0] + col(i, j, k, 0));
          f[i][j][k][1] =
              min(f[i][j][k][1], f[i - 1][j][k][1] + col(i, j, k, 0));
        }
        if (j) {
          f[i][j][k][0] =
              min(f[i][j][k][0], f[i][j - 1][k][0] + col(i, j, k, 1));
        }
        if (k) {
          f[i][j][k][0] =
              min(f[i][j][k][0], f[i][j][k - 1][0] + col(i, j, k, 2));
          f[i][j][k][0] =
              min(f[i][j][k][0], f[i][j][k - 1][1] + col(i, j, k, 2));
        }
      }
  cout << min(f[r1][r2][r3][0], f[r1][r2][r3][1]) << endl;
}
}  // namespace solution
int main() {
  using namespace solution;
  Prepare();
  Solve();
  return 0;
}
