#include <bits/stdc++.h>   using namespace std;   inline int upd(int& a, int b) { return a = min(a, b); }   inline int _abs(int x) { return x > 0 ? x : -x; }   char c;   int n, cnt[3], type[80];   int pos[3][80], leq[3][80];   int dp[80][80][80][80];   void getpos(void) {     for (int p = 0; p <= 2; p++) {       cnt[p] = 0;       for (int y = 1; y <= n; y++) {         while (y <= n && type[y] != p) y++;         if (y <= n) pos[p][++cnt[p]] = y;       }       leq[p][0] = 0;       for (int i = 1; i <= n; i++) leq[p][i] = leq[p][i - 1] + (type[i] == p);     }     return;   }   void trans(int i, int j, int k, int lst) {     int p0 = pos[0][i], p1 = pos[1][j], p2 = pos[2][k];     if (i > 0)       upd(dp[0][i][j][k],           dp[lst][i - 1][j][k] + _abs(j - leq[1][p0]) + _abs(k - leq[2][p0]));     if (j > 0)       upd(dp[1][i][j][k],           dp[lst][i][j - 1][k] + _abs(i - leq[0][p1]) + _abs(k - leq[2][p1]));     if (k > 0 && lst != 1)       upd(dp[2][i][j][k],           dp[lst][i][j][k - 1] + _abs(i - leq[0][p2]) + _abs(j - leq[1][p2]));     return;   }   int main(void) {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf(  %c , &c);       type[i] = (c ==  V  ? 1 : (c ==  K  ? 2 : 0));     }     getpos();     memset(dp, 0x1f, sizeof(dp));     dp[0][0][0][0] = 0;     for (int i = 0; i <= cnt[0]; i++)       for (int j = 0; j <= cnt[1]; j++)         for (int k = 0; k <= cnt[2]; k++)           for (int lst = 0; lst <= 2; lst++) trans(i, j, k, lst);     int ans = n * n;     for (int i = 0; i <= 2; i++) upd(ans, dp[i][cnt[0]][cnt[1]][cnt[2]]);     printf( %d n , ans >> 1);     return 0;   }   