#include <bits/stdc++.h>
using namespace std;
int dp[76][76][76][2], n, N, M, K;
string s;
int GetCount(char c) {
  int ans = 0;
  for (int i = 0; i < s.size(); i++) ans += (s[i] == c);
  return ans;
}
void PreProcess() {
  for (int i = 0; i < s.size(); i++)
    if (s[i] != 'V' && s[i] != 'K') s[i] = 'X';
  N = GetCount('V');
  M = GetCount('K');
  K = GetCount('X');
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= M; j++)
      for (int k = 0; k <= K; k++)
        for (int x = 0; x < 2; x++) dp[i][j][k][x] = 1E9;
  dp[0][0][0][0] = dp[0][0][0][1] = 0;
}
int GetPosition(char c, int cnt) {
  int i;
  for (i = 0; i < s.size() && cnt > 0; i++) cnt -= (s[i] == c);
  return i - 1;
}
int GetCurrentAns(int pos, int c1, int c2, int c3) {
  for (int i = 0; i < pos; i++) {
    c1 -= (s[i] == 'V');
    c2 -= (s[i] == 'K');
    c3 -= (s[i] == 'X');
  }
  return max(0, -c1) + max(0, -c2) + max(0, -c3);
}
int main() {
  int ans = 1E9;
  cin >> n >> s;
  PreProcess();
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= M; j++)
      for (int k = 0; k <= K; k++)
        for (int x = 0; x < 2; x++) {
          if (i < N)
            dp[i + 1][j][k][1] =
                min(dp[i + 1][j][k][1],
                    dp[i][j][k][x] +
                        GetCurrentAns(GetPosition('V', i + 1), i, j, k));
          if (x == 0 && j < M)
            dp[i][j + 1][k][0] =
                min(dp[i][j + 1][k][0],
                    dp[i][j][k][x] +
                        GetCurrentAns(GetPosition('K', j + 1), i, j, k));
          if (k < K)
            dp[i][j][k + 1][0] =
                min(dp[i][j][k + 1][0],
                    dp[i][j][k][x] +
                        GetCurrentAns(GetPosition('X', k + 1), i, j, k));
        }
  for (int x = 0; x < 2; x++) ans = min(ans, dp[N][M][K][x]);
  cout << ans << '\n';
  return 0;
}
