#include <bits/stdc++.h>
using namespace std;
const int N = 80;
int n;
char s[N + 10];
int vcnt, kcnt, xcnt;
bool vis[N + 10];
long long dp[N + 2][N + 2][N + 2][4];
void trans(int v, int k, int x, int t) {
  memset(vis, 0, sizeof(vis));
  int vcnt = 1, kcnt = 1, xcnt = 1;
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'V') {
      if (vcnt <= v) vis[i] = true, vcnt++;
    } else if (s[i] == 'K') {
      if (kcnt <= k) vis[i] = true, kcnt++;
    } else {
      if (xcnt <= x) vis[i] = true, xcnt++;
    }
  }
  int v_blank = 0, k_blank = 0, x_blank = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'V' && !vis[i]) break;
    if (!vis[i]) v_blank++;
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'K' && !vis[i]) break;
    if (!vis[i]) k_blank++;
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] != 'V' && s[i] != 'K' && !vis[i]) break;
    if (!vis[i]) x_blank++;
  }
  dp[v + 1][k][x][1] = min(dp[v + 1][k][x][1], dp[v][k][x][t] + v_blank);
  if (t != 1)
    dp[v][k + 1][x][2] = min(dp[v][k + 1][x][2], dp[v][k][x][t] + k_blank);
  dp[v][k][x + 1][3] = min(dp[v][k][x + 1][3], dp[v][k][x][t] + x_blank);
}
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++)
    if (s[i] == 'V')
      vcnt++;
    else if (s[i] == 'K')
      kcnt++;
    else
      xcnt++;
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int i = 0; i <= vcnt; i++)
    for (int j = 0; j <= kcnt; j++)
      for (int k = 0; k <= xcnt; k++) {
        if (i == 0 && j == 0 && k == 0)
          trans(0, 0, 0, 0);
        else
          for (int t = 1; t <= 3; t++) trans(i, j, k, t);
      }
  long long ans = 0x3f3f3f3f3f3f3f3f;
  for (int i = 1; i <= 3; i++) ans = min(ans, dp[vcnt][kcnt][xcnt][i]);
  printf("%lld\n", ans);
  return 0;
}
