#include <bits/stdc++.h>
using namespace std;
const int N = 75 + 5;
int n, dp[N][N][N][3], cnt[5], plck[N], plcv[N], plcth[N], arr[N];
string s;
int add(int th, int v, int k, int rn) {
  int rtr = 0;
  for (int i = 0; i < rn; i++) {
    if (s[i] == 'K')
      rtr += (arr[i] > k);
    else if (s[i] == 'V')
      rtr += (arr[i] > v);
    else
      rtr += (arr[i] > th);
  }
  return rtr;
}
int main() {
  cin >> n >> s;
  memset(dp, 1, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'K')
      cnt[2]++, arr[i] = cnt[2], plck[cnt[2]] = i;
    else if (s[i] == 'V')
      cnt[1]++, arr[i] = cnt[1], plcv[cnt[1]] = i;
    else
      cnt[0]++, arr[i] = cnt[0], plcth[cnt[0]] = i;
  }
  for (int sum = 1; sum <= s.size(); sum++) {
    for (int th = 0; th <= min(cnt[0], sum); th++) {
      for (int v = 0; v <= cnt[1], v + th <= sum; v++) {
        int k = sum - (th + v);
        if (k > 0)
          dp[th][v][k][0] = dp[th][v][k - 1][0] + add(th, v, k, plck[k]);
        if (v > 0)
          dp[th][v][k][1] = min(dp[th][v - 1][k][0], dp[th][v - 1][k][1]) +
                            add(th, v, k, plcv[v]);
        if (th > 0)
          dp[th][v][k][0] = min(dp[th][v][k][0],
                                min(dp[th - 1][v][k][0], dp[th - 1][v][k][1]) +
                                    add(th, v, k, plcth[th]));
      }
    }
  }
  cout << min(dp[cnt[0]][cnt[1]][cnt[2]][0], dp[cnt[0]][cnt[1]][cnt[2]][1]);
  return 0;
}
