#include <bits/stdc++.h>
#pragma GCC target("sse4.2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long N = 80 + 2;
long long n, dp[N][N][N][3], A, B, C;
string s;
inline long long f(long long aa, long long bb, long long cc, char col,
                   long long num) {
  long long cnt = 0, pt = 0, a = 0, b = 0, c = 0, ans = 0;
  while (cnt < num) {
    if (s[pt] == 'A') {
      if (a < aa)
        a++;
      else
        ans++;
    } else if (s[pt] == 'B') {
      if (b < bb)
        b++;
      else
        ans++;
    } else {
      if (c < cc)
        c++;
      else
        ans++;
    }
    if (s[pt] == col) cnt++;
    pt++;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  cin >> n >> s;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'V')
      s[i] = 'A', A++;
    else if (s[i] == 'K')
      s[i] = 'B', B++;
    else
      s[i] = 'C', C++;
  }
  for (long long a = 0; a < A + 1; a++) {
    for (long long b = 0; b < B + 1; b++) {
      for (long long c = 0; c < C + 1; c++) {
        long long* d = dp[a][b][c];
        if (max(a, max(b, c)) == 0) {
          d[0] = d[1] = d[2] = 0;
          continue;
        }
        long long* tmp = dp[a - 1][b][c];
        d[0] = (a == 0 ? LLONG_MAX / 2
                       : min(tmp[0], min(tmp[1], tmp[2])) + f(a, b, c, 'A', a));
        tmp = dp[a][b - 1][c];
        d[1] =
            (b == 0 ? LLONG_MAX / 2 : min(tmp[1], tmp[2]) + f(a, b, c, 'B', b));
        tmp = dp[a][b][c - 1];
        d[2] = (c == 0 ? LLONG_MAX / 2
                       : min(tmp[0], min(tmp[1], tmp[2])) + f(a, b, c, 'C', c));
        cout << endl;
      }
    }
  }
  long long* d = dp[A][B][C];
  cout << min(d[0], min(d[1], d[2]));
  return 0;
}
