#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 75;
const int INF = 1 << 30;
enum { V, K, X };
char s[MAX_N + 4];
int ids[MAX_N], cns[3];
int dp[MAX_N + 1][MAX_N + 1][MAX_N + 1][2];
inline int cid(char c) {
  if (c == 'V') return V;
  if (c == 'K') return K;
  return X;
}
void calcmv(int n, int ccs[], int ds[]) {
  int cis[3];
  fill(cis, cis + 3, 0);
  fill(ds, ds + 3, -1);
  int k = ccs[V] + ccs[K] + ccs[X];
  for (int i = 0; i < n; i++) {
    int id = ids[i];
    if (++cis[id] > ccs[id]) {
      if (ds[id] < 0) ds[id] = k;
      k++;
    }
  }
}
inline void setmin(int &a, int b) {
  if (a > b) a = b;
}
int main() {
  int n;
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; i++) cns[ids[i] = cid(s[i])]++;
  for (int i = 0; i <= cns[V]; i++)
    for (int j = 0; j <= cns[K]; j++)
      for (int k = 0; k <= cns[X]; k++) fill(dp[i][j][k], dp[i][j][k] + 2, INF);
  dp[0][0][0][0] = 0;
  for (int i = 0; i <= cns[V]; i++)
    for (int j = 0; j <= cns[K]; j++)
      for (int k = 0; k <= cns[X]; k++) {
        int l = i + j + k;
        int ccs[3] = {i, j, k}, ds[3];
        calcmv(n, ccs, ds);
        if (dp[i][j][k][0] < INF) {
          if (i < cns[V])
            setmin(dp[i + 1][j][k][1], dp[i][j][k][0] + (ds[V] - l));
          if (j < cns[K])
            setmin(dp[i][j + 1][k][0], dp[i][j][k][0] + (ds[K] - l));
          if (k < cns[X])
            setmin(dp[i][j][k + 1][0], dp[i][j][k][0] + (ds[X] - l));
        }
        if (dp[i][j][k][1] < INF) {
          if (i < cns[V])
            setmin(dp[i + 1][j][k][1], dp[i][j][k][1] + (ds[V] - l));
          if (k < cns[X])
            setmin(dp[i][j][k + 1][0], dp[i][j][k][1] + (ds[X] - l));
        }
      }
  printf("%d\n",
         min(dp[cns[V]][cns[K]][cns[X]][0], dp[cns[V]][cns[K]][cns[X]][1]));
  return 0;
}
