#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c > 57 || c < 48) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c > 47 && c < 58) x = x * 10 + c - 48, c = getchar();
  return x * f;
}
int n, a[3][105], p[3], dp[105][105][105][3];
char s[105];
int calc(int x, int y, int z, int k) {
  int ans = 0;
  for (int i = 1; i <= x; i++) ans += (a[0][i] > k);
  for (int i = 1; i <= y; i++) ans += (a[1][i] > k);
  for (int i = 1; i <= z; i++) ans += (a[2][i] > k);
  return ans;
}
int main() {
  scanf("%d%s", &n, s + 1);
  for (int i = 1; i <= n; i++)
    if (s[i] == 'V')
      a[0][++p[0]] = i;
    else if (s[i] == 'K')
      a[1][++p[1]] = i;
    else
      a[2][++p[2]] = i;
  memset(dp, 63, sizeof(dp));
  dp[0][0][0][1] = 0;
  for (int i = 1; i <= n; i++)
    for (int x = 0; x <= p[0]; x++)
      for (int y = 0; y <= p[1]; y++)
        for (int l = 0; l < 2; l++) {
          int z = i - 1 - x - y;
          if (z < 0 || z > p[2]) continue;
          if (x < p[0])
            ((dp[i][x + 1][y][0] >
              (dp[i - 1][x][y][l] + calc(x, y, z, a[0][x + 1])))
                 ? dp[i][x + 1][y][0] =
                       (dp[i - 1][x][y][l] + calc(x, y, z, a[0][x + 1]))
                 : 0);
          if (y < p[1] && l)
            ((dp[i][x][y + 1][1] >
              (dp[i - 1][x][y][l] + calc(x, y, z, a[1][y + 1])))
                 ? dp[i][x][y + 1][1] =
                       (dp[i - 1][x][y][l] + calc(x, y, z, a[1][y + 1]))
                 : 0);
          if (z < p[2])
            ((dp[i][x][y][1] >
              (dp[i - 1][x][y][l] + calc(x, y, z, a[2][z + 1])))
                 ? dp[i][x][y][1] =
                       (dp[i - 1][x][y][l] + calc(x, y, z, a[2][z + 1]))
                 : 0);
        }
  printf("%d", min(dp[n][p[0]][p[1]][0], dp[n][p[0]][p[1]][1]));
  return 0;
}
