#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9 + 1e8;
const int maxn = 102;
int n, vs, ks, os;
int arr[maxn];
int dp[maxn][maxn][maxn][3];
string st;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> st;
  for (int i = 0; i < n; ++i) {
    if (st[i] == 'V')
      vs += 1, arr[i] = vs;
    else if (st[i] == 'K')
      ks += 1, arr[i] = ks;
    else
      os += 1, arr[i] = os;
  }
  for (int i = 0; i <= vs; ++i) {
    for (int j = 0; j <= ks; ++j) {
      for (int t = 0; t <= os; ++t) {
        dp[i][j][t][0] = dp[i][j][t][1] = dp[i][j][t][2] = inf;
      }
    }
  }
  dp[0][0][0][2] = 0;
  for (int i = 0; i <= vs; ++i) {
    for (int j = 0; j <= ks; ++j) {
      for (int p = 0; p <= os; ++p) {
        for (int f = 0; f < 3; ++f)
          if (dp[i][j][p][f] < inf) {
            for (int t = 0; t < 3; ++t) {
              if (f == 0 && t == 1) continue;
              if (t == 0 && i == vs) continue;
              if (t == 1 && j == ks) continue;
              if (t == 2 && p == os) continue;
              int nu = 0, nw = 0, pos = 0;
              if (t == 0) {
                while (nw < i + 1) {
                  if (st[pos] == 'V')
                    nw += 1;
                  else if (st[pos] == 'K' && arr[pos] > j)
                    nu += 1;
                  else if (st[pos] != 'K' && arr[pos] > p)
                    nu += 1;
                  pos += 1;
                }
              } else if (t == 1) {
                while (nw < j + 1) {
                  if (st[pos] == 'V' && arr[pos] > i)
                    nu += 1;
                  else if (st[pos] == 'K')
                    nw += 1;
                  else if (arr[pos] > p && st[pos] != 'V')
                    nu += 1;
                  pos += 1;
                }
              } else {
                while (nw < p + 1) {
                  if (st[pos] == 'V' && arr[pos] > i)
                    nu += 1;
                  else if (st[pos] == 'K' && arr[pos] > j)
                    nu += 1;
                  else if (st[pos] != 'K' && st[pos] != 'V')
                    nw += 1;
                  pos += 1;
                }
              }
              dp[i + (t == 0 ? 1 : 0)][j + (t == 1 ? 1 : 0)]
                [p + (t == 2 ? 1 : 0)][t] =
                    min(dp[i + (t == 0 ? 1 : 0)][j + (t == 1 ? 1 : 0)]
                          [p + (t == 2 ? 1 : 0)][t],
                        dp[i][j][p][f] + nu);
            }
          }
      }
    }
  }
  cout << min(dp[vs][ks][os][0], min(dp[vs][ks][os][1], dp[vs][ks][os][2]));
  return 0;
}
