#include <bits/stdc++.h>
using namespace std;
const long long maxn = 7e1 + 7;
const long long mod = 1e9 + 7;
const long long INF = 1e9 + 7;
const long long mlog = 20;
const long long SQ = 400;
long long n;
char a[maxn];
bool b[maxn];
long long V, K, X;
long long dp[maxn][maxn][maxn][2];
long long solve(long long v, long long k, long long x, long long lv) {
  if (v + k + x == n) return 0;
  if (dp[v][k][x][lv] != -1) return dp[v][k][x][lv];
  long long res = +INF;
  if (v < V) {
    long long tmp = 0;
    long long i;
    for (i = 0; i < n; i++) {
      if (b[i]) continue;
      if (a[i] == 'V') break;
      tmp++;
    }
    b[i] = true;
    res = min(res, tmp + solve(v + 1, k, x, 1));
    b[i] = false;
  }
  if (k < K && lv == 0) {
    long long tmp = 0;
    long long i;
    for (i = 0; i < n; i++) {
      if (b[i]) continue;
      if (a[i] == 'K') break;
      tmp++;
    }
    b[i] = true;
    res = min(res, tmp + solve(v, k + 1, x, 0));
    b[i] = false;
  }
  if (x < X) {
    long long tmp = 0;
    long long i;
    for (i = 0; i < n; i++) {
      if (b[i]) continue;
      if (a[i] == 'X') break;
      tmp++;
    }
    b[i] = true;
    res = min(res, tmp + solve(v, k, x + 1, 0));
    b[i] = false;
  }
  return dp[v][k][x][lv] = res;
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(), cout.tie();
  ;
  memset(dp, -1, sizeof(dp));
  cin >> n;
  string s;
  cin >> s;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'V' || s[i] == 'K') {
      a[i] = s[i];
      if (s[i] == 'V')
        V++;
      else
        K++;
    } else {
      a[i] = 'X';
      X++;
    }
  }
  cout << solve(0, 0, 0, 0) << "\n";
  return 0;
}
