#include <bits/stdc++.h>   using namespace std;   int main() {     int n, mncnt = 1000000000, cnt;     string a;     string c =  ACTG ;     cin >> n >> a;     for (int i = 0; i <= n - 4; i++) {       cnt = 0;       string b = a.substr(i, 4);       for (int j = 0; j < 4; j++) {         int x = c[j] -  A ;         int y = b[j] -  A ;         if (abs(y - x) <= 13)           cnt += abs(y - x);         else           cnt += 26 - (abs(y - x));       }       mncnt = min(mncnt, cnt);     }     cout << mncnt << endl;   }   