#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<int> vpos, kpos, xpos;
int topk = 0, topv = 0, topx = 0;
int dp[76][76][76][2];
int get(int v, int k, int x, int ind) {
  int ans = 0;
  for (int i = 0; i < ind; i++) {
    if (s[i] == 'V') {
      if (v == 0)
        ans++;
      else
        v--;
    } else if (s[i] == 'K') {
      if (k == 0)
        ans++;
      else
        k--;
    } else {
      if (x == 0)
        ans++;
      else
        x--;
    }
  }
  return ans;
}
int f(int v, int k, int x, int lastv) {
  if (v + k + x == n) return 0;
  if (dp[v][k][x][lastv] != -1) return dp[v][k][x][lastv];
  int ans1 = 1e8;
  int ans2 = 1e8;
  int ans3 = 1e8;
  if (v < topv) ans1 = f(v + 1, k, x, 1) + get(v, k, x, vpos[v]);
  if (k < topk && !lastv) ans2 = f(v, k + 1, x, 0) + get(v, k, x, kpos[k]);
  if (x < topx) ans3 = f(v, k, x + 1, 0) + get(v, k, x, xpos[x]);
  dp[v][k][x][lastv] = min(ans1, min(ans2, ans3));
  return min(ans1, min(ans2, ans3));
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'V')
      vpos.push_back(i), topv++;
    else if (s[i] == 'K')
      kpos.push_back(i), topk++;
    else
      xpos.push_back(i), topx++;
  }
  for (int i1 = 0; i1 < 76; i1++)
    for (int i2 = 0; i2 < 76; i2++)
      for (int i3 = 0; i3 < 76; i3++)
        for (int i4 = 0; i4 < 2; i4++) dp[i1][i2][i3][i4] = -1;
  cout << f(0, 0, 0, 0) << endl;
}
