#include <bits/stdc++.h>
using namespace std;
const int mx = 80 + 10;
const int mod = 1e9 + 7;
int n, k;
char s[mx];
vector<int> v[3];
vector<pair<int, int> > cnt[3];
int num[3];
int dp[mx][mx][mx][2];
int main() {
  scanf("%d", &n);
  scanf("%s", s);
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'V')
      ++num[0];
    else if (s[i] == 'K')
      ++num[1];
    else
      ++num[2];
    if (s[i] == 'V')
      v[0].push_back(i), cnt[0].push_back(make_pair(num[1], num[2]));
    else if (s[i] == 'K')
      v[1].push_back(i), cnt[1].push_back(make_pair(num[0], num[2]));
    else
      v[2].push_back(i), cnt[2].push_back(make_pair(num[0], num[1]));
  }
  memset(dp, 0x3f3f3f3f, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int i = 0; i <= v[0].size(); ++i) {
    for (int j = 0; j <= v[1].size(); ++j) {
      for (int k = 0; k <= v[2].size(); ++k) {
        if (i == 0 && j == 0 && k == 0) continue;
        if (k) {
          dp[i][j][k][0] = min(
              dp[i][j][k][0], dp[i][j][k - 1][0] + max(cnt[2][k - 1].first, i) +
                                  max(cnt[2][k - 1].second, j) - i - j);
          dp[i][j][k][0] = min(
              dp[i][j][k][0], dp[i][j][k - 1][1] + max(cnt[2][k - 1].first, i) +
                                  max(cnt[2][k - 1].second, j) - i - j);
        }
        if (j) {
          dp[i][j][k][0] = min(
              dp[i][j][k][0], dp[i][j - 1][k][0] + max(cnt[1][j - 1].first, i) +
                                  max(cnt[1][j - 1].second, k) - i - k);
        }
        if (i) {
          dp[i][j][k][1] = min(
              dp[i][j][k][1], dp[i - 1][j][k][0] + max(cnt[0][i - 1].first, j) +
                                  max(cnt[0][i - 1].second, k) - j - k);
          dp[i][j][k][1] = min(
              dp[i][j][k][1], dp[i - 1][j][k][1] + max(cnt[0][i - 1].first, j) +
                                  max(cnt[0][i - 1].second, k) - j - k);
        }
      }
    }
  }
  printf("%d\n", min(dp[v[0].size()][v[1].size()][v[2].size()][0],
                     dp[v[0].size()][v[1].size()][v[2].size()][1]));
}
