#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n;
int A[100];
string second;
int dp[88][88][88][4];
int k[3] = {0, 0, 0};
int can(int a, int b) {
  if (a == 0 && b == 1) return false;
  return true;
}
int calc(int a, int b, int c, int last) {
  if (a > k[0] || b > k[1] || c > k[2]) return inf;
  if (a == k[0] && b == k[1] && c == k[2]) return 0;
  int &res = dp[a][b][c][last];
  if (res != -1) return res;
  int tmp[3] = {a, b, c};
  vector<int> cur;
  for (int i = 0; i < n; i++) {
    if (tmp[A[i]] == 0)
      cur.push_back(A[i]);
    else
      tmp[A[i]]--;
  }
  tmp[0] = a;
  tmp[1] = b;
  tmp[2] = c;
  res = inf;
  for (int i = 0; i < cur.size(); i++) {
    int t = cur[i];
    tmp[t]++;
    if (can(last, t)) res = min(res, i + calc(tmp[0], tmp[1], tmp[2], t));
    tmp[t]--;
  }
  return res;
}
int main() {
  cin >> n >> second;
  for (int i = 0; i < n; i++) {
    if (second[i] == 'V')
      A[i] = 0;
    else if (second[i] == 'K')
      A[i] = 1;
    else
      A[i] = 2;
  }
  for (int i = 0; i < n; i++) {
    k[A[i]]++;
  }
  memset(dp, -1, sizeof dp);
  printf("%d\n", calc(0, 0, 0, 2));
  return 0;
}
