#include <bits/stdc++.h>
using namespace std;
const int maxn = 80;
int dp[maxn][maxn][maxn][3];
int inf = 1e9;
string s;
int n;
int find(int ind, int k, int v, int x) {
  int ck = 0, cv = 0, cx = 0;
  int cnt = 0;
  for (int i = 0; i < ind; i++) {
    if (s[i] == 'K') {
      if (ck < k)
        ck++;
      else
        cnt++;
    }
    if (s[i] == 'V') {
      if (cv < v)
        cv++;
      else
        cnt++;
    }
    if (s[i] == 'X') {
      if (cx < x)
        cx++;
      else
        cnt++;
    }
  }
  return cnt;
}
void solve(int k, int v, int x) {
  int nk = -1, nv = -1, nx = -1, ck = 0, cv = 0, cx = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'V' && cv <= v) {
      cv++;
      nv = i;
    } else if (s[i] == 'K' && ck <= k) {
      ck++;
      nk = i;
    } else if (s[i] == 'X' && cx <= x) {
      cx++;
      nx = i;
    }
  }
  int fv = find(nv, k, v, x);
  int fk = find(nk, k, v, x);
  int fx = find(nx, k, v, x);
  dp[k][v][x + 1][0] =
      min(dp[k][v][x + 1][0], min(dp[k][v][x][1], dp[k][v][x][0]) + fx);
  dp[k][v + 1][x][1] =
      min(dp[k][v + 1][x][1], min(dp[k][v][x][1], dp[k][v][x][0]) + fv);
  dp[k + 1][v][x][0] = min(dp[k + 1][v][x][0], dp[k][v][x][0] + fk);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  cin >> s;
  int vc = 0, kc = 0, xc = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] != 'V' && s[i] != 'K') {
      xc++;
      s[i] = 'X';
    }
    vc += (s[i] == 'V');
    kc += (s[i] == 'K');
  }
  for (int i = 0; i <= kc; i++) {
    for (int j = 0; j <= vc; j++) {
      for (int k = 0; k <= xc; k++) {
        for (int t = 0; t < 2; t++) {
          dp[i][j][k][t] = inf;
        }
      }
    }
  }
  dp[0][0][0][0] = 0;
  for (int i = 0; i <= kc; i++) {
    for (int j = 0; j <= vc; j++) {
      for (int k = 0; k <= xc; k++) {
        solve(i, j, k);
      }
    }
  }
  cout << min(dp[kc][vc][xc][0], dp[kc][vc][xc][1]);
  return 0;
}
