#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 110;
int p[3][maxn];
int sum[maxn][3];
int f[maxn][maxn][maxn][5];
int n;
int cost(int i, int x, int y, int z) {
  int pos;
  if (z == 0) pos = p[0][i - x - y];
  if (z == 1) pos = p[1][x];
  if (z == 2) pos = p[2][y];
  if (pos > n) return inf;
  int res = pos - i;
  int b, c;
  if (z == 0) {
    b = sum[pos][1];
    c = sum[pos][2];
    if (b < x) res += x - b;
    if (c < y) res += y - c;
  }
  if (z == 1) {
    b = sum[pos][0];
    c = sum[pos][2];
    if (b < i - x - y) res += i - x - y - b;
    if (c < y) res += y - c;
  }
  if (z == 2) {
    b = sum[pos][0];
    c = sum[pos][1];
    if (b < i - x - y) res += i - x - y - b;
    if (c < x) res += x - c;
  }
  return res;
}
char s[maxn];
int a[maxn];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  memset(sum, 0, sizeof(sum));
  memset(p, 0x3f, sizeof(p));
  for (int i = 1; i <= n; i++)
    if (s[i] == 'V')
      a[i] = 1;
    else if (s[i] == 'K')
      a[i] = 2;
    else
      a[i] = 0;
  int s0 = 0, s1 = 0, s2 = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0) {
      s0++;
      p[0][s0] = i;
    }
    if (a[i] == 1) {
      s1++;
      p[1][s1] = i;
    }
    if (a[i] == 2) {
      s2++;
      p[2][s2] = i;
    }
    sum[i][0] = sum[i - 1][0];
    sum[i][1] = sum[i - 1][1];
    sum[i][2] = sum[i - 1][2];
    sum[i][a[i]]++;
  }
  memset(f, 0x3f, sizeof(f));
  f[0][0][0][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int x = 0; x <= s1; x++)
      for (int y = 0; y <= s2; y++) {
        int j = i - 1;
        if (x + y > i) continue;
        for (int z = 0; z <= 3; z++) {
          if (i - x - y > 0)
            f[i][x][y][0] =
                min(f[i][x][y][0], f[j][x][y][z] + cost(i, x, y, 0));
          if (x > 0)
            f[i][x][y][1] =
                min(f[i][x][y][1], f[j][x - 1][y][z] + cost(i, x, y, 1));
          if (y > 0 && z != 1)
            f[i][x][y][2] =
                min(f[i][x][y][2], f[j][x][y - 1][z] + cost(i, x, y, 2));
        }
      }
  int ans = inf;
  ans = min(ans, f[n][s1][s2][0]);
  ans = min(ans, f[n][s1][s2][1]);
  ans = min(ans, f[n][s1][s2][2]);
  printf("%d\n", ans);
}
