#include <bits/stdc++.h>
using namespace std;
const int N = 523456;
const int inf = (int)1e9 + 7;
int n;
int d[76][76][76][2];
string s;
vector<int> F, S, T;
int ret(vector<int> used, int l, int r) {
  int pos = r;
  for (int j = 0; j < n; ++j) {
    if (used[j]) {
      if (j > r) {
        ++pos;
      }
    }
  }
  return (pos > l ? pos - l : l - pos);
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'V') {
      F.push_back(i);
    } else if (s[i] == 'K') {
      S.push_back(i);
    } else {
      T.push_back(i);
    }
  }
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k <= n; ++k) {
        d[i][j][k][0] = d[i][j][k][1] = inf;
      }
    }
  }
  d[0][0][0][0] = 0;
  for (int i = 0; i <= (int)F.size(); ++i) {
    for (int j = 0; j <= (int)S.size(); ++j) {
      for (int k = 0; k <= (int)T.size(); ++k) {
        vector<int> used(n, 0);
        for (int t = 0; t < i; ++t) {
          used[F[t]] = 1;
        }
        for (int t = 0; t < j; ++t) {
          used[S[t]] = 1;
        }
        for (int t = 0; t < k; ++t) {
          used[T[t]] = 1;
        }
        int pos = i + j + k;
        if (i < (int)F.size()) {
          d[i + 1][j][k][1] =
              min(d[i + 1][j][k][1],
                  min(d[i][j][k][0], d[i][j][k][1]) + ret(used, pos, F[i]));
        }
        if (j < (int)S.size()) {
          d[i][j + 1][k][0] =
              min(d[i][j + 1][k][0], d[i][j][k][0] + ret(used, pos, S[j]));
        }
        if (k < (int)T.size()) {
          d[i][j][k + 1][0] =
              min(d[i][j][k + 1][0],
                  min(d[i][j][k][1], d[i][j][k][0]) + ret(used, pos, T[k]));
        }
      }
    }
  }
  printf("%d", min(d[(int)F.size()][(int)S.size()][(int)T.size()][0],
                   d[(int)F.size()][(int)S.size()][(int)T.size()][1]));
  return 0;
}
