#include <bits/stdc++.h>
using namespace std;
struct pfx {
  int s[3];
};
int operator-(pfx x, pfx y) {
  int ret = 0;
  for (int(i) = (0); (i) < (3); ++(i)) ret += max(0, x.s[i] - y.s[i]);
  return ret;
}
const int maxn = 80;
const int inf = 1ll << 25;
int n, mn = inf, dp[maxn][maxn][maxn][3];
char s[maxn], t[maxn];
pfx vkx[3][maxn];
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false);
  cin >> n;
  pfx tt;
  tt.s[0] = tt.s[1] = tt.s[2] = 0;
  for (int(i) = (0); (i) < (n); ++(i)) {
    char c;
    int x;
    cin >> c, x = (c == 'V' ? 0 : c == 'K' ? 1 : 2);
    ++tt.s[x], vkx[x][tt.s[x]] = tt;
  }
  for (int(v) = (0); (v) < (n + 1); ++(v))
    for (int(k) = (0); (k) < (n + 1); ++(k))
      for (int(x) = (0); (x) < (n + 1); ++(x))
        for (int(i) = (0); (i) < (3); ++(i)) dp[v][k][x][i] = inf;
  dp[0][0][0][2] = 0;
  for (int(v) = (0); (v) < (n); ++(v))
    for (int(k) = (0); (k) < (n); ++(k))
      for (int(x) = (0); (x) < (n); ++(x)) {
        if (v + k + x >= n) continue;
        for (int(i) = (0); (i) < (3); ++(i))
          for (int(j) = (0); (j) < (3); ++(j))
            if (!(i == 0 && j == 1)) {
              pfx nn;
              nn.s[0] = v + (j == 0), nn.s[1] = k + (j == 1),
              nn.s[2] = x + (j == 2);
              if (nn.s[0] > tt.s[0] || nn.s[1] > tt.s[1] || nn.s[2] > tt.s[2])
                continue;
              dp[nn.s[0]][nn.s[1]][nn.s[2]][j] =
                  min(dp[nn.s[0]][nn.s[1]][nn.s[2]][j],
                      dp[v][k][x][i] + (nn - vkx[j][nn.s[j]]));
            }
      }
  for (int(i) = (0); (i) < (3); ++(i))
    mn = min(mn, dp[tt.s[0]][tt.s[1]][tt.s[2]][i]);
  cout << mn;
}
