#include <bits/stdc++.h>
using namespace std;
vector<int> V, K, O;
int dp[76][76][76][3];
int dfs(int v, int k, int o, int kind, vector<int>& p);
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'V') {
      V.push_back(i);
    } else if (s[i] == 'K') {
      K.push_back(i);
    } else {
      O.push_back(i);
    }
  }
  vector<int> p(n);
  int ans = dfs(V.size(), K.size(), O.size(), 0, p);
  ans = min(ans, dfs(V.size(), K.size(), O.size(), 1, p));
  ans = min(ans, dfs(V.size(), K.size(), O.size(), 2, p));
  cout << ans << endl;
}
int dfs(int v, int k, int o, int kind, vector<int>& p) {
  if (v == 0 && k == 0 && o == 0 && kind == 2) {
    return 0;
  }
  if (dp[v][k][o][kind]) {
    return dp[v][k][o][kind] - 1;
  }
  int pos;
  if (kind == 2) {
    if (o <= 0) {
      return 10000;
    }
    --o;
    pos = O[o];
    p[pos] = 1;
    int ans = 10000;
    int extra = 1;
    for (int i = 0; i < pos; ++i) {
      extra += p[i];
    }
    ans = min(ans, dfs(v, k, o, 0, p));
    ans = min(ans, dfs(v, k, o, 1, p));
    ans = min(ans, dfs(v, k, o, 2, p));
    p[pos] = 0;
    dp[v][k][o + 1][kind] = ans + extra;
    return dp[v][k][o + 1][kind] - 1;
  }
  if (kind == 1) {
    if (k <= 0) {
      return 10000;
    }
    --k;
    pos = K[k];
    p[pos] = 1;
    int ans = 10000;
    int extra = 1;
    for (int i = 0; i < pos; ++i) {
      extra += p[i];
    }
    ans = min(ans, dfs(v, k, o, 1, p));
    ans = min(ans, dfs(v, k, o, 2, p));
    p[pos] = 0;
    dp[v][k + 1][o][kind] = ans + extra;
    return dp[v][k + 1][o][kind] - 1;
  }
  if (kind == 0) {
    if (v <= 0) {
      return 10000;
    }
    --v;
    pos = V[v];
    p[pos] = 1;
    int ans = 10000;
    int extra = 1;
    for (int i = 0; i < pos; ++i) {
      extra += p[i];
    }
    ans = min(ans, dfs(v, k, o, 0, p));
    ans = min(ans, dfs(v, k, o, 1, p));
    ans = min(ans, dfs(v, k, o, 2, p));
    p[pos] = 0;
    dp[v + 1][k][o][kind] = ans + extra;
    return dp[v + 1][k][o][kind] - 1;
  }
}
