#include <bits/stdc++.h>
using namespace std;
const int maxn = 80;
const int inf = 0x3f3f3f3f;
int n;
char str[maxn];
int pos[3][maxn];
int pre[3][maxn];
int dp[maxn][maxn][maxn][2];
int d(int v, int k, int x, int f) {
  if ((v | k | x | f) == 0) return 0;
  int& ans = dp[v][k][x][f];
  if (ans != -1) return ans;
  ans = inf;
  if (f) {
    int p = pos[0][v];
    int add =
        max(0, pre[0][p] - v) + max(0, pre[1][p] - k) + max(0, pre[2][p] - x);
    if (v) {
      ans = min(ans, d(v - 1, k, x, 0) + add);
      ans = min(ans, d(v - 1, k, x, 1) + add);
      return ans;
    } else
      return ans = inf;
  } else {
    if (k) {
      int p = pos[1][k];
      int add =
          max(0, pre[0][p] - v) + max(0, pre[1][p] - k) + max(0, pre[2][p] - x);
      ans = min(ans, d(v, k - 1, x, 0) + add);
    }
    if (x) {
      int p = pos[2][x];
      int add =
          max(0, pre[0][p] - v) + max(0, pre[1][p] - k) + max(0, pre[2][p] - x);
      ans = min(ans, d(v, k, x - 1, 0) + add);
      ans = min(ans, d(v, k, x - 1, 1) + add);
    }
    return ans;
  }
}
void init() {
  int v = 0, k = 0, x = 0;
  scanf("%d %s", &n, str);
  for (int i = 0; i < n; i++) {
    pre[0][i] = v;
    pre[1][i] = k;
    pre[2][i] = x;
    if (str[i] == 'V') {
      v++;
      pos[0][v] = i;
    } else if (str[i] == 'K') {
      k++;
      pos[1][k] = i;
    } else {
      x++;
      pos[2][x] = i;
    }
  }
  memset(dp, -1, sizeof(dp));
  printf("%d\n", min(d(v, k, x, 0), d(v, k, x, 1)));
}
int main() {
  init();
  return 0;
}
