#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 100;

int n, ind[N], dp[N];
int sum, mn;
bool vis[N];
char s[N];

struct edg {
  int v;
  edg *nxt;
} pol[N << 1], *h[N], *cur = pol;

void add(int u, int v) {
  edg *p = ++cur, *q = ++cur;
  ind[u]++, ind[v]++;
  p->v = v, p->nxt = h[u], h[u] = p;
  q->v = u, q->nxt = h[v], h[v] = q;
}

void topo() {
  queue <int> Q;
  for (int i = 1; i <= n; i++) {
    if (s[i] == 'B' && ind[i] == 1) {
      Q.push(i);
    }
  }
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    vis[u] = 1;
    for (edg *p = h[u]; p; p = p->nxt) {
      int v = p->v;
      if (ind[v]) ind[v]--;
      if (s[v] == 'B' && ind[v] == 1 && vis[v] == 0) {
        Q.push(v);
      }
    }
  }
}

int tp(int u) {
  return (ind[u] & 1) ^ (s[u] == 'W');
}

int val(int u) {
  return tp(u) == 1 ? -2 : 0;
}

void dfs(int u, int fa) {
  sum += (tp(u) == 1) + 2;
  dp[u] = val(u);
  for (edg *p = h[u]; p; p = p->nxt) {
    int v = p->v;
    if (v == fa || vis[v]) continue ;
    dfs(v, u);
    mn = min(mn, dp[u] + dp[v]);
    dp[u] = min(dp[u], dp[v] + val(u));
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    add(u, v);
  }
  scanf("%s", s + 1);
  topo();
  int x = 1;
  while (x <= n) {
    if (vis[x] == 0) break ;
    x++;
  }
  dfs(x, 0);
  sum -= 2;
  printf("%d\n", sum + mn);
  return 0;
}