#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int cost[80][80][80][3];
int dp[80][80][80][3];
int rek(int i, int j, int k, int last) {
  if (i == 0 and j == 0 and k == 0) return 0;
  if (dp[i][j][k][last] != -1) return dp[i][j][k][last];
  int ret = (1 << 30);
  if (i > 0) {
    ret = min(ret, rek(i - 1, j, k, 0) + cost[i][j][k][0]);
  }
  if (j > 0 && last != 0) {
    ret = min(ret, rek(i, j - 1, k, 1) + cost[i][j][k][1]);
  }
  if (k > 0) {
    ret = min(ret, rek(i, j, k - 1, 2) + cost[i][j][k][2]);
  }
  return dp[i][j][k][last] = ret;
}
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  memset(dp, -1, sizeof dp);
  cin >> n >> s;
  int V = 0, K = 0, O = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'V')
      ++V;
    else if (s[i] == 'K')
      ++K;
    else
      ++O;
  }
  for (int i = 0; i <= V; ++i) {
    for (int j = 0; j <= K; ++j) {
      for (int x = 0; x <= O; ++x) {
        int vv = V - i;
        int vk = K - j;
        int vo = O - x;
        for (int it = 0; it < n; it++) {
          if (s[it] == 'V') {
            if (vv == 0) {
              cost[i][j][x][0] = max(-vk, 0) + max(-vo, 0);
            }
            vv--;
          } else if (s[it] == 'K') {
            if (vk == 0) {
              cost[i][j][x][1] = max(-vv, 0) + max(-vo, 0);
            }
            vk--;
          } else {
            if (vo == 0) {
              cost[i][j][x][2] = max(-vv, 0) + max(-vk, 0);
            }
            vo--;
          }
        }
      }
    }
  }
  cout << rek(V, K, O, 2);
  return 0;
}
