#include <bits/stdc++.h>
using namespace std;
char s[100];
int dp[100][100][100][5];
int ss[100];
int main() {
  int n;
  scanf("%d %s", &n, s);
  int all = 0x3f3f3f3f, vn = 0, kn = 0, xn = 0;
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  for (int i = 0; i < n; i++) {
    if (s[i] == 'V')
      ss[i] = 1, vn++;
    else if (s[i] == 'K')
      ss[i] = 2, kn++;
    else
      ss[i] = 0, xn++;
  }
  for (int i = 0; i < 3; i++) dp[0][0][0][i] = 0;
  for (int v = 0; v <= vn; v++) {
    for (int k = 0; k <= kn; k++) {
      for (int x = 0; x <= xn; x++) {
        if (x + k + v == n) continue;
        int cnt[3];
        cnt[0] = x;
        cnt[1] = v;
        cnt[2] = k;
        int pos[3] = {0, 0, 0};
        int tot = 0;
        for (int i = 0; i < n; i++) {
          if (cnt[ss[i]])
            cnt[ss[i]]--;
          else {
            tot++;
            if (!pos[ss[i]]) pos[ss[i]] = tot;
          }
        }
        for (int i = 0; i < 3; i++) {
          if (dp[v][k][x][i] == 0x3f3f3f3f) continue;
          dp[v + 1][k][x][1] =
              min(dp[v + 1][k][x][1], dp[v][k][x][i] + pos[1] - 1);
          dp[v][k][x + 1][0] =
              min(dp[v][k][x + 1][0], dp[v][k][x][i] + pos[0] - 1);
          if (i != 1)
            dp[v][k + 1][x][2] =
                min(dp[v][k + 1][x][2], dp[v][k][x][i] + pos[2] - 1);
        }
      }
    }
  }
  all = min(all, dp[vn][kn][xn][0]);
  all = min(all, dp[vn][kn][xn][1]);
  all = min(all, dp[vn][kn][xn][2]);
  printf("%d\n", all);
  return 0;
}
