#include <bits/stdc++.h>
using namespace std;
#pragma optimize("-O3")
int dp[76][76][76][2];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  string st;
  cin >> st;
  for (int i = 0; i < 76; i++) {
    for (int j = 0; j < 76; j++) {
      for (int k = 0; k < 76; k++) {
        for (int l = 0; l < 2; l++) {
          dp[i][j][k][l] = 1e9;
        }
      }
    }
  }
  dp[0][0][0][0] = 0;
  dp[0][0][0][1] = 0;
  vector<vector<int>> v;
  v.resize(3);
  for (int i = 0; i < st.size(); i++) {
    if (st[i] == 'V') {
      v[0].push_back(i);
    } else if (st[i] == 'K') {
      v[1].push_back(i);
    } else {
      v[2].push_back(i);
    }
  }
  int sz1 = v[0].size();
  int sz2 = v[1].size();
  int sz3 = v[2].size();
  for (int i = 0; i <= sz1; i++) {
    for (int j = 0; j <= sz2; j++) {
      for (int k = 0; k <= sz3; k++) {
        for (int l = 0; l < 2; l++) {
          if (l == 0) {
            if (k != v[2].size()) {
              int pos = v[2][k];
              int val = 0;
              int ans = 0;
              for (auto u : v[0]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - i);
              val = 0;
              for (auto u : v[1]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - j);
              dp[i][j][k + 1][1] =
                  min(dp[i][j][k + 1][1], dp[i][j][k][0] + ans);
            }
            if (i != v[0].size()) {
              int pos = v[0][i];
              int val = 0;
              int ans = 0;
              for (auto u : v[1]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - j);
              val = 0;
              for (auto u : v[2]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - k);
              dp[i + 1][j][k][0] =
                  min(dp[i + 1][j][k][0], dp[i][j][k][0] + ans);
            }
          } else {
            if (i != v[0].size()) {
              int pos = v[0][i];
              int val = 0;
              int ans = 0;
              for (auto u : v[1]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - j);
              val = 0;
              for (auto u : v[2]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - k);
              dp[i + 1][j][k][0] =
                  min(dp[i + 1][j][k][0], dp[i][j][k][1] + ans);
            }
            if (j != v[1].size()) {
              int pos = v[1][j];
              int val = 0;
              int ans = 0;
              for (auto u : v[0]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - i);
              val = 0;
              for (auto u : v[2]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - k);
              dp[i][j + 1][k][1] =
                  min(dp[i][j + 1][k][1], dp[i][j][k][1] + ans);
            }
            if (k != v[2].size()) {
              int pos = v[2][k];
              int val = 0;
              int ans = 0;
              for (auto u : v[0]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - i);
              val = 0;
              for (auto u : v[1]) {
                if (u < pos) {
                  val++;
                }
              }
              ans += max(0, val - j);
              dp[i][j][k + 1][1] =
                  min(dp[i][j][k + 1][1], dp[i][j][k][1] + ans);
            }
          }
        }
      }
    }
  }
  cout << min(dp[sz1][sz2][sz3][0], dp[sz1][sz2][sz3][1]);
  return 0;
}
