#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T BM(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T mdINV(T a, T M) {
  return BM(a, M - 2, M);
}
template <class T>
inline T PW(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
template <class T>
string NTS(T Number) {
  stringstream ss;
  ss << Number;
  return ss.str();
}
template <class T>
T stringtonumber(const string &Text) {
  istringstream ss(Text);
  T result;
  return ss >> result ? result : 0;
}
template <class T>
bool ISLEFT(T a, T b, T c) {
  if (((a.first.first - b.first.first) * (b.second.second - c.second.second) -
       (b.first.first - c.first.first) * (a.second.second - b.second.second)) <
      0.0)
    return 1;
  else
    return 0;
}
int dp[76 + 2][76 + 2][76 + 2][2];
int n;
char a[76 + 2];
int ar[76 + 2];
int cnt;
int go(int v, int k, int first, bool fl) {
  if (v + k + first == n) return 0;
  int &ret = dp[v][k][first][fl];
  if (ret != -1) return ret;
  ret = 10000000;
  cnt++;
  int cnv = v, cnk = k, cnx = first;
  for (int i = 1; i <= n; i++) {
    if (cnv && a[i] == 'V') {
      cnv--;
      ar[i] = cnt;
    }
    if (cnk && a[i] == 'K') {
      cnk--;
      ar[i] = cnt;
    }
    if (cnx && a[i] == 'X') {
      cnx--;
      ar[i] = cnt;
    }
  }
  int costv = 0, costk = 0, costx = 0;
  bool flv = 0, flk = 0, flx = 0;
  for (int i = 1; i <= n; i++) {
    if (ar[i] == cnt) continue;
    if (a[i] == 'V') {
      flv = 1;
    } else if (flv == 0)
      costv++;
    if (a[i] == 'K') {
      flk = 1;
    } else if (flk == 0)
      costk++;
    if (a[i] == 'X') {
      flx = 1;
    } else if (flx == 0)
      costx++;
  }
  if (flv) ret = min(ret, costv + go(v + 1, k, first, 1));
  if (!fl && flk) ret = min(ret, costk + go(v, k + 1, first, 0));
  if (flx) ret = min(ret, costx + go(v, k, first + 1, 0));
  return ret;
}
int main() {
  scanf("%d", &n);
  scanf("%s", a + 1);
  for (int i = 1; i <= n; i++)
    if (a[i] == 'V' || a[i] == 'K') {
    } else
      a[i] = 'X';
  memset(dp, -1, sizeof dp);
  printf("%d", go(0, 0, 0, 0));
  printf("\n");
  return 0;
}
