#include <bits/stdc++.h>   using namespace std;   template <typename T>   T in() {     char ch;     T n = 0;     bool ng = false;     while (1) {       ch = getchar();       if (ch ==  - ) {         ng = true;         ch = getchar();         break;       }       if (ch >=  0  && ch <=  9 ) break;     }     while (1) {       n = n * 10 + (ch -  0 );       ch = getchar();       if (ch <  0  || ch >  9 ) break;     }     return (ng ? -n : n);   }   template <typename T>   inline T POW(T B, T P) {     if (P == 0) return 1;     if (P & 1)       return B * POW(B, P - 1);     else       return (POW(B, P / 2) * POW(B, P / 2));   }   template <typename T>   inline T Gcd(T a, T b) {     if (a < 0) return Gcd(-a, b);     if (b < 0) return Gcd(a, -b);     return (b == 0) ? a : Gcd(b, a % b);   }   template <typename T>   inline T Lcm(T a, T b) {     if (a < 0) return Lcm(-a, b);     if (b < 0) return Lcm(a, -b);     return a * (b / Gcd(a, b));   }   long long Bigmod(long long base, long long power, long long MOD) {     long long ret = 1;     while (power) {       if (power & 1) ret = (ret * base) % MOD;       base = (base * base) % MOD;       power >>= 1;     }     return ret;   }   bool isVowel(char ch) {     ch = toupper(ch);     if (ch ==  A  || ch ==  U  || ch ==  I  || ch ==  O  || ch ==  E )       return true;     return false;   }   template <typename T>   long long int isLeft(T a, T b, T c) {     return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);   }   long long ModInverse(long long number, long long MOD) {     return Bigmod(number, MOD - 2, MOD);   }   bool isConst(char ch) {     if (isalpha(ch) && !isVowel(ch)) return true;     return false;   }   int toInt(string s) {     int sm;     stringstream second(s);     second >> sm;     return sm;   }   int a[3][77];   int Ln[3];   int n;   int dp[77][77][77][2];   int lol(int v, int k, int x, int f) {     if ((v + k + x) == n) return 0;     int &res = dp[v][k][x][f];     if (res != -1) return res;     res = 20000;     int np = v + k + x + 1;     if (v < Ln[1]) {       int tp = 0;       int ps = a[1][v];       for (int i = x; i < Ln[0]; i++) {         if (a[0][i] < ps)           tp++;         else           break;       }       for (int i = k; i < Ln[2]; i++) {         if (a[2][i] < ps)           tp++;         else           break;       }       res = min(res, tp + lol(v + 1, k, x, 1));     }     if (!f) {       if (k < Ln[2]) {         int tp = 0;         int ps = a[2][k];         for (int i = x; i < Ln[0]; i++) {           if (a[0][i] < ps)             tp++;           else             break;         }         for (int i = v; i < Ln[1]; i++) {           if (a[1][i] < ps)             tp++;           else             break;         }         res = min(res, tp + lol(v, k + 1, x, 0));       }     }     if (x < Ln[0]) {       int tp = 0;       int ps = a[0][x];       for (int i = v; i < Ln[1]; i++) {         if (a[1][i] < ps)           tp++;         else           break;       }       for (int i = k; i < Ln[2]; i++) {         if (a[2][i] < ps)           tp++;         else           break;       }       res = min(res, tp + lol(v, k, x + 1, 0));     }     return res;   }   map<char, int> mp;   int main() {     mp[ V ] = 1;     mp[ K ] = 2;     string s;     cin >> n;     cin >> s;     for (int i = 1; i <= n; i++) {       int tp = mp[s[i - 1]];       a[tp][Ln[tp]] = i;       Ln[tp]++;     }     memset(dp, -1, sizeof(dp));     cout << lol(0, 0, 0, 0) << endl;     return 0;   }