#include <bits/stdc++.h>
using namespace std;
int num[105];
int n;
char st[105];
int cnt[30];
int main() {
  cin >> n;
  scanf("%s", st + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  for (int i = 1; i <= n; i++) {
    cnt[st[i] - 'a']++;
  }
  int cns = 0;
  int mx = 0;
  for (int i = 0; i < 26; i++) mx = max(mx, cnt[i]);
  if (mx > n / 2) {
    puts("0");
    return 0;
  }
  mx = 0;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= n / 2; i++)
    if (st[i] == st[n + 1 - i]) cnt[st[i] - 'a']++, cns++;
  for (int i = 0; i <= 26; i++)
    if (cnt[i] > cnt[mx]) mx = i;
  int res = -1;
  vector<int> v;
  if (cnt[mx] > cns / 2) {
    res = 2 * cnt[mx] - cns;
  } else
    res = 0;
  int ans = 0;
  for (int i = 1; i <= n / 2; i++) {
    if (st[i] == st[n + 1 - i])
      ans += max(num[i], num[n + 1 - i]);
    else
      ans += num[i] + num[n + 1 - i];
  }
  if (res) {
    for (int i = 1; i <= n / 2; i++) {
      if (st[i] != st[n + 1 - i]) {
        if (st[i] == mx + 'a' || st[n + 1 - i] == mx + 'a') {
          continue;
        }
        v.push_back(min(num[i], num[n + 1 - i]));
      }
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < res; i++) {
      ans -= v[i];
    }
  }
  cout << ans << endl;
  return 0;
}
