#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const long double PI = acos((long double)-1.0);
const long double eps = 1e-6;
unsigned long long getRand() {
  return ((unsigned long long)rand() << 40) +
         ((unsigned long long)rand() << 20) + ((unsigned long long)rand());
}
char s[101];
int stepsV[101][101];
int stepsK[101][101];
long long dp[101][101][101][3];
bool visited[101][101][101][3];
int n;
int normieC;
int countV;
int countK;
int timesCalled = 0;
bool visited1[101];
int findChar(int normie, int v, int k, int charType) {
  for (int(i) = (0); (i) < (101); ++(i)) visited1[i] = false;
  int countNormie = 0;
  int countVe = 0;
  int countKe = 0;
  for (int(i) = (1); (i) < (n + 1); ++(i)) {
    if (s[i] != 'V' && s[i] != 'K') {
      if (countNormie == normie) {
        continue;
      }
      countNormie++;
      visited1[i] = true;
    } else if (s[i] == 'V') {
      if (countVe == v) {
        continue;
      }
      countVe++;
      visited1[i] = true;
    } else if (s[i] == 'K') {
      if (countKe == k) {
        continue;
      }
      countKe++;
      visited1[i] = true;
    }
  }
  int movesNeeded = 0;
  if (charType == 0) {
    for (int(i) = (1); (i) < (n + 1); ++(i)) {
      if (!visited1[i] && s[i] != 'V') {
        movesNeeded++;
      } else if (s[i] == 'V' && !visited1[i]) {
        return movesNeeded;
      }
    }
  } else if (charType == 1) {
    for (int(i) = (1); (i) < (n + 1); ++(i)) {
      if (!visited1[i] && s[i] != 'K') {
        movesNeeded++;
      } else if (s[i] == 'K' && !visited1[i]) {
        return movesNeeded;
      }
    }
  } else if (charType == 2) {
    for (int(i) = (1); (i) < (n + 1); ++(i)) {
      if (!visited1[i] && (s[i] == 'V' || s[i] == 'K')) {
        movesNeeded++;
      } else if ((s[i] != 'V' && s[i] != 'K') && !visited1[i]) {
        return movesNeeded;
      }
    }
  }
  return INT_MAX;
}
void solve(int index, int v, int k, int lastChar) {
  if (index > n) {
    visited[index][v][k][lastChar] = true;
    dp[index][v][k][lastChar] = INT_MAX;
    return;
  }
  if (index == n) {
    visited[index][v][k][lastChar] = true;
    if (v == countV && k == countK) {
      dp[index][v][k][lastChar] = 0;
      return;
    } else {
      dp[index][v][k][lastChar] = INT_MAX;
      return;
    }
  } else {
    if (visited[index][v][k][lastChar]) {
      return;
    } else {
      long long res = INT_MAX;
      int posN = findChar(index - (v + k), v, k, 2);
      int posV = findChar(index - (v + k), v, k, 0);
      int posK = findChar(index - (v + k), v, k, 1);
      int min1 = -1;
      if (lastChar == 0) {
        if (posN != INT_MAX) {
          solve(index + 1, v, k, 2);
          assert(visited[index + 1][v][k][2]);
          res = min(res, posN + dp[index + 1][v][k][2]);
          if (res == posN + dp[index + 1][v][k][2]) {
            min1 = 2;
          }
        }
        if (posV != INT_MAX) {
          solve(index + 1, v + 1, k, 0);
          assert(visited[index + 1][v + 1][k][0]);
          res = min(res, posV + dp[index + 1][v + 1][k][0]);
          if (res == posV + dp[index + 1][v + 1][k][0]) {
            min1 = 0;
          }
        }
      } else {
        if (posN != INT_MAX) {
          solve(index + 1, v, k, 2);
          assert(visited[index + 1][v][k][2]);
          res = min(res, posN + dp[index + 1][v][k][2]);
          if (res == posN + dp[index + 1][v][k][2]) {
            min1 = 2;
          }
        }
        if (posV != INT_MAX) {
          solve(index + 1, v + 1, k, 0);
          assert(visited[index + 1][v + 1][k][0]);
          res = min(res, posV + dp[index + 1][v + 1][k][0]);
          if (res == posV + dp[index + 1][v + 1][k][0]) {
            min1 = 0;
          }
        }
        if (posK != INT_MAX) {
          solve(index + 1, v, k + 1, 1);
          assert(visited[index + 1][v][k + 1][1]);
          res = min(res, posK + dp[index + 1][v][k + 1][1]);
          if (res == posK + dp[index + 1][v][k + 1][1]) {
            min1 = 1;
          }
        }
      }
      dp[index][v][k][lastChar] = res;
      visited[index][v][k][lastChar] = true;
      return;
    }
  }
}
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int(i) = (1); (i) < (n + 1); ++(i)) {
    if (s[i] == 'V') {
      countV++;
    } else if (s[i] == 'K') {
      countK++;
    } else {
      normieC++;
    }
  }
  solve(0, 0, 0, 2);
  printf("%lld\n", dp[0][0][0][2]);
  return 0;
}
