#include <bits/stdc++.h>
using namespace std;
int cnt1, cnt2, cnt3;
int f[100][100][100][4];
string s;
int n;
int a[20000];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin >> s;
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == 'V')
      a[i] = 1;
    else if (s[i - 1] == 'K')
      a[i] = 2;
    else
      a[i] = 3;
    if (a[i] == 1)
      cnt1++;
    else if (a[i] == 2)
      cnt2++;
    else if (a[i] == 3)
      cnt3++;
  }
  for (int i = 0; i <= cnt1; i++)
    for (int j = 0; j <= cnt2; j++)
      for (int k = 0; k <= cnt3; k++)
        for (int tp = 1; tp <= 3; tp++) f[i][j][k][tp] = 1e9;
  f[0][0][0][3] = 0;
  for (int i = 0; i <= cnt1; i++)
    for (int j = 0; j <= cnt2; j++)
      for (int k = 0; k <= cnt3; k++)
        for (int tp = 1; tp <= 3; tp++) {
          if (f[i][j][k][tp] == 1e9) continue;
          int q1 = 0, q2 = 0, q3 = 0, cnt = -1;
          for (int t = 1; t <= n; t++) {
            if (a[t] == 1) {
              q1++;
              if (q1 > i) cnt++;
            }
            if (a[t] == 2) {
              q2++;
              if (q2 > j) cnt++;
            }
            if (a[t] == 3) {
              q3++;
              if (q3 > k) cnt++;
            }
            if (q1 == i + 1 && a[t] == 1)
              f[i + 1][j][k][1] = min(f[i + 1][j][k][1], f[i][j][k][tp] + cnt);
            if (q2 == j + 1 && a[t] == 2 && tp != 1)
              f[i][j + 1][k][2] = min(f[i][j + 1][k][2], f[i][j][k][tp] + cnt);
            if (q3 == k + 1 && a[t] == 3)
              f[i][j][k + 1][3] = min(f[i][j][k + 1][3], f[i][j][k][tp] + cnt);
          }
        }
  cout << min(min(f[cnt1][cnt2][cnt3][1], f[cnt1][cnt2][cnt3][2]),
              f[cnt1][cnt2][cnt3][3]);
  return 0;
}
