#include <bits/stdc++.h>
using namespace std;
template <class _Tp>
void ckmax(_Tp &a, _Tp b) {
  if (a < b) a = b;
}
template <class _Tp>
void ckmin(_Tp &a, _Tp b) {
  if (a > b) a = b;
}
template <class _Tp>
_Tp gcd(_Tp a, _Tp b) {
  return (b == 0) ? (a) : (gcd(b, a % b));
}
int read() {
  char ch = getchar();
  bool f = 1;
  int x = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') f = 0, ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch & 15);
    ch = getchar();
  }
  return f ? x : -x;
}
const int inf = 1000000000;
const long long Inf = 1000000000000000000ll;
int n;
char s[100];
bool vis[100];
int f[100][100][100][4];
void upt(int &x, int y) { x = min(x, y); }
void trans(int v, int k, int x, int t) {
  memset(vis, 0, sizeof(vis));
  int cnt = 1;
  for (register int i = 1; i <= n && cnt <= v; ++i)
    if (s[i] == 'V') cnt++, vis[i] = 1;
  cnt = 1;
  for (register int i = 1; i <= n && cnt <= k; ++i)
    if (s[i] == 'K') cnt++, vis[i] = 1;
  cnt = 1;
  for (register int i = 1; i <= n && cnt <= x; ++i)
    if (s[i] != 'V' && s[i] != 'K') cnt++, vis[i] = 1;
  int v_ = 0, k_ = 0, x_ = 0;
  for (register int i = 1; i <= n; ++i) {
    if (s[i] == 'V' && !vis[i]) break;
    if (!vis[i]) ++v_;
  }
  for (register int i = 1; i <= n; ++i) {
    if (s[i] == 'K' && !vis[i]) break;
    if (!vis[i]) ++k_;
  }
  for (register int i = 1; i <= n; ++i) {
    if (s[i] != 'V' && s[i] != 'K' && !vis[i]) break;
    if (!vis[i]) ++x_;
  }
  upt(f[v + 1][k][x][1], f[v][k][x][t] + v_);
  if (t != 1) upt(f[v][k + 1][x][2], f[v][k][x][t] + k_);
  upt(f[v][k][x + 1][3], f[v][k][x][t] + x_);
}
int main() {
  n = read();
  scanf("%s", s + 1);
  int cntv = 0, cntk = 0, cntx = 0;
  for (register int i = 1; i <= n; ++i) {
    if (s[i] == 'V')
      cntv++;
    else if (s[i] == 'K')
      cntk++;
    else
      cntx++;
  }
  memset(f, 0x3f, sizeof(f));
  f[0][0][0][0] = 0;
  for (register int i = 0; i <= cntv; ++i)
    for (register int j = 0; j <= cntk; ++j)
      for (register int k = 0; k <= cntx; ++k)
        if (i == 0 && j == 0 && k == 0)
          trans(0, 0, 0, 0);
        else {
          for (register int t = 1; t <= 3; ++t) trans(i, j, k, t);
        }
  int ans = 1000000000;
  for (register int i = 1; i <= 3; ++i) ans = min(ans, f[cntv][cntk][cntx][i]);
  printf("%d\n", ans);
  return 0;
}
