#include <bits/stdc++.h>
using namespace std;
const int N = 80;
const int INF = 1e6;
char s[N];
int a[N], n, f[N][N][N][3], sum[N][3], b[3];
inline void Min(int &x, int y) {
  if (y < x) x = y;
}
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++)
    if (s[i] == 'V')
      a[i] = 1;
    else if (s[i] == 'K')
      a[i] = 2;
  for (int i = 1; i <= n; i++) {
    sum[i][0] = sum[i - 1][0] + (a[i] == 0);
    sum[i][1] = sum[i - 1][1] + (a[i] == 1);
    sum[i][2] = sum[i - 1][2] + (a[i] == 2);
  }
  for (int i = 0; i < 3; i++) b[i] = sum[n][i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      for (int k = 0; k < N; k++)
        for (int p = 0; p < 3; p++) f[i][j][k][p] = INF;
  f[0][0][0][0] = 0;
  for (int i = 0; i <= b[0]; i++)
    for (int j = 0; j <= b[1]; j++)
      for (int k = 0; k <= b[2]; k++)
        for (int last = 0; last < 3; last++) {
          if (i < b[0]) {
            for (int p = 1; p <= n; p++)
              if (sum[p][0] == i + 1) {
                Min(f[i + 1][j][k][0], f[i][j][k][last] +
                                           max(0, sum[p][1] - j) +
                                           max(0, sum[p][2] - k));
                break;
              }
          }
          if (j < b[1]) {
            for (int p = 1; p <= n; p++)
              if (sum[p][1] == j + 1) {
                Min(f[i][j + 1][k][1], f[i][j][k][last] +
                                           max(0, sum[p][0] - i) +
                                           max(0, sum[p][2] - k));
                break;
              }
          }
          if (k < b[2]) {
            if (last != 1)
              for (int p = 1; p <= n; p++)
                if (sum[p][2] == k + 1) {
                  Min(f[i][j][k + 1][2], f[i][j][k][last] +
                                             max(0, sum[p][0] - i) +
                                             max(0, sum[p][1] - j));
                  break;
                }
          }
        }
  int ans = INF;
  ans = min(f[b[0]][b[1]][b[2]][0],
            min(f[b[0]][b[1]][b[2]][1], f[b[0]][b[1]][b[2]][2]));
  cout << ans << endl;
  return 0;
}
