#include <bits/stdc++.h>
using namespace std;
const int nmax = 77;
int f[nmax][nmax][nmax][2], V[nmax], K[nmax], X[nmax], pv[nmax], pk[nmax],
    px[nmax], n;
int tinh(int v, int k, int x, int is) {
  if (v + k + x == n) return 0;
  if (f[v][k][x][is] != -1) return f[v][k][x][is];
  int res = 1000000000;
  if (v < V[n]) {
    int i = pv[v + 1];
    res = min(res, tinh(v + 1, k, x, 1) + max(v - V[i], 0) + max(k - K[i], 0) +
                       max(x - X[i], 0));
  }
  if (k < K[n] && !is) {
    int i = pk[k + 1];
    res = min(res, tinh(v, k + 1, x, 0) + max(v - V[i], 0) + max(k - K[i], 0) +
                       max(x - X[i], 0));
  }
  if (x < X[n]) {
    int i = px[x + 1];
    res = min(res, tinh(v, k, x + 1, 0) + max(v - V[i], 0) + max(k - K[i], 0) +
                       max(x - X[i], 0));
  }
  return f[v][k][x][is] = res;
}
int main() {
  string s;
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    V[i] = V[i - 1];
    K[i] = K[i - 1];
    X[i] = X[i - 1];
    if (s[i - 1] == 'V') pv[++V[i]] = i;
    if (s[i - 1] == 'K') pk[++K[i]] = i;
    if (s[i - 1] != 'V' && s[i - 1] != 'K') px[++X[i]] = i;
  }
  memset(f, 255, sizeof(f));
  cout << tinh(0, 0, 0, 0);
}
