#include <bits/stdc++.h>
using namespace std;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <>
struct bytetype<4> {};
template <>
struct bytetype<3> {};
template <>
struct bytetype<2> {};
template <>
struct bytetype<1> {};
template <>
struct bytetype<0> {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
template <class T>
T next(istream& in) {
  T ret;
  in >> ret;
  return ret;
}
const int MAXN = 77;
const int INF = (int)1e9;
int n;
vector<int> s;
int dp[MAXN][MAXN][MAXN][4];
int n0, n1, n2;
int getCost(const vector<int>& s, int p0, int p1, int p2, int what) {
  vector<int> u(s.size(), 0);
  int cnt = 0;
  for (int i = 0; i < (s.size()); ++i) {
    if (s[i] == 0 && cnt < p0) {
      u[i] = 1;
      ++cnt;
    }
    if (cnt >= p0) break;
  }
  cnt = 0;
  for (int i = 0; i < (s.size()); ++i) {
    if (s[i] == 1 && cnt < p1) {
      u[i] = 1;
      ++cnt;
    }
    if (cnt >= p1) break;
  }
  cnt = 0;
  for (int i = 0; i < (s.size()); ++i) {
    if (s[i] == 2 && cnt < p2) {
      u[i] = 1;
      ++cnt;
    }
    if (cnt >= p2) break;
  }
  cnt = -1;
  for (int i = 0; i < (s.size()); ++i) {
    if (s[i] == what && !u[i]) {
      cnt = i;
      break;
    }
  }
  if (cnt == -1) throw 42;
  int idx = cnt;
  cnt = 0;
  for (int i = 0; i < (idx); ++i) {
    if (!u[i]) {
      ++cnt;
    }
  }
  return cnt;
}
void solve(istream& in, ostream& out) {
  n = next<int>(in);
  string ss = next<string>(in);
  s = vector<int>(n);
  n0 = n1 = n2 = 0;
  for (int i = 0; i < (n); ++i) {
    if (ss[i] == 'V') {
      s[i] = 0;
      ++n0;
    } else if (ss[i] == 'K') {
      s[i] = 1;
      ++n1;
    } else {
      s[i] = 2;
      ++n2;
    }
  }
  for (int i = 0; i < (n0 + 1); ++i)
    for (int j = 0; j < (n1 + 1); ++j)
      for (int k = 0; k < (n2 + 1); ++k)
        for (int d = 0; d < (4); ++d) dp[i][j][k][d] = INF;
  dp[0][0][0][3] = 0;
  for (int placed0 = 0; placed0 < (n0 + 1); ++placed0) {
    for (int placed1 = 0; placed1 < (n1 + 1); ++placed1) {
      if (placed0 + placed1 == n0 + n1) {
        break;
      }
      for (int placed2 = 0; placed2 < (n2 + 1); ++placed2) {
        int t = 3;
        if (dp[placed0][placed1][placed2][t] != INF) {
          int cur_dp = dp[placed0][placed1][placed2][t];
          dp[placed0][placed1][placed2][1] =
              min(dp[placed0][placed1][placed2][1], cur_dp);
          if (placed2 < n2) {
            int next_cost = getCost(s, placed0, placed1, placed2, 2);
            dp[placed0][placed1][placed2 + 1][3] =
                min(dp[placed0][placed1][placed2 + 1][3], cur_dp + next_cost);
          }
        }
        t = 1;
        if (dp[placed0][placed1][placed2][t] != INF) {
          int cur_dp = dp[placed0][placed1][placed2][t];
          dp[placed0][placed1][placed2][0] =
              min(dp[placed0][placed1][placed2][0], cur_dp);
          if (placed1 < n1) {
            int next_cost = getCost(s, placed0, placed1, placed2, 1);
            dp[placed0][placed1 + 1][placed2][1] =
                min(dp[placed0][placed1 + 1][placed2][1], cur_dp + next_cost);
          }
        }
        t = 0;
        if (dp[placed0][placed1][placed2][t] != INF) {
          int cur_dp = dp[placed0][placed1][placed2][t];
          dp[placed0][placed1][placed2][2] =
              min(dp[placed0][placed1][placed2][2], cur_dp);
          if (placed0 < n0) {
            int next_cost = getCost(s, placed0, placed1, placed2, 0);
            dp[placed0 + 1][placed1][placed2][0] =
                min(dp[placed0 + 1][placed1][placed2][0], cur_dp + next_cost);
          }
        }
        t = 2;
        if (dp[placed0][placed1][placed2][t] != INF) {
          int cur_dp = dp[placed0][placed1][placed2][t];
          if (placed2 < n2) {
            int next_cost = getCost(s, placed0, placed1, placed2, 2);
            dp[placed0][placed1][placed2 + 1][3] =
                min(dp[placed0][placed1][placed2 + 1][3], cur_dp + next_cost);
          }
        }
      }
    }
  }
  int res = INF;
  for (int placed2 = 0; placed2 < (n2 + 1); ++placed2) {
    for (int t = 0; t < (4); ++t) {
      res = min(res, dp[n0][n1][placed2][t]);
    }
  }
  out << res << endl;
}
int main() {
  solve(cin, cout);
  return 0;
}
