#include <bits/stdc++.h>
using namespace std;
const long long oo = 0x3f3f3f3f3f3f3f3fll;
const int LGN = 25;
const int MOD = 1e9 + 7;
const int N = 75 + 5;
int n, cnt[N][3], idx[N][3];
char s[N];
char w[3] = {'V', 'K', 'X'};
int f(int v, int k, int x, int isv) {
  if (v + k + x == n) return 0;
  static int dp[N][N][N][2];
  static bool mark[N][N][N][2];
  auto& ans = dp[v][k][x][isv];
  if (mark[v][k][x][isv]) return ans;
  mark[v][k][x][isv] = true;
  ans = oo;
  int ct[3] = {v, k, x};
  for (long long j = 0, __R = 2; j <= __R; j++)
    if (j != 1 || !isv) {
      if (ct[j] >= cnt[n][j]) continue;
      int i = idx[ct[j] + 1][j];
      int a = 0;
      for (long long z = 0, __R = 2; z <= __R; z++)
        a += min(cnt[i - 1][z], ct[z]);
      ct[j]++;
      ans = min(ans, i - 1 - a + f(ct[0], ct[1], ct[2], j == 0));
      ct[j]--;
    }
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  scanf("%d", &(n));
  scanf("%s", s + 1);
  for (long long i = 1, __R = n; i <= __R; i++) {
    int j;
    if (s[i] == 'V')
      j = 0;
    else if (s[i] == 'K')
      j = 1;
    else
      j = 2;
    cnt[i][j] = cnt[i - 1][j] + 1;
    idx[cnt[i][j]][j] = i;
    for (long long z = 0, __R = 2; z <= __R; z++)
      if (z != j) cnt[i][z] = cnt[i - 1][z];
  }
  printf("%d\n", f(0, 0, 0, 0));
  return 0;
}
