#include <bits/stdc++.h>
using namespace std;
const int N = 80;
const int oo = 1e9;
int dp[N][N][N][2];
int cnt[N][3], n;
int V, K, O;
string str;
int cost(int v, int k, int o, int f, int t) {
  if (t == 1 && f) return oo;
  int ret = 0;
  for (auto u : str) {
    if (u == 'V')
      v--;
    else if (u == 'K')
      k--;
    else
      o--;
    if (t == 0 && v == 0) break;
    if (t == 1 && k == 0) break;
    if (t == 2 && o == 0) break;
  }
  return abs(v) + abs(k) + abs(o);
}
int recur(int v, int k, int o, int f) {
  if (v > V || k > K || o > O) return oo;
  if (v + k + o == n) return 0;
  if (dp[v][k][o][f] != -1) return dp[v][k][o][f];
  int ret = oo;
  ret = min(ret, cost(v + 1, k, o, f, 0) + recur(v + 1, k, o, 1));
  ret = min(ret, cost(v, k + 1, o, f, 1) + recur(v, k + 1, o, 0));
  ret = min(ret, cost(v, k, o + 1, f, 2) + recur(v, k, o + 1, 0));
  return dp[v][k][o][f] = ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  cin >> str;
  for (auto c : str) {
    if (c == 'V')
      V++;
    else if (c == 'K')
      K++;
    else
      O++;
  }
  memset(dp, -1, sizeof(dp));
  cout << recur(0, 0, 0, 0) / 2 << endl;
  return 0;
}
