#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#define N 100005
using namespace std;

inline void cmax(int &x, int &y, int z) {
    if (y < z) swap(y, z);
    if (x < y) swap(x, y);
    if (y < z) swap(y, z);
}

int n, rt, deg[N], c[N], ers[N], f[N], res;
int tot, fir[N], nxt[N << 1], to[N << 1];
queue<int> q;

inline void addE(int u, int v) {
    nxt[++tot] = fir[u], fir[u] = tot, to[tot] = v;
}

void dfs(int u, int p = 0) {
    int fi = 0, se = 0;
    for (int i = fir[u], v; i; i = nxt[i]) {
        v = to[i];
        if (v == p || ers[v]) continue;
        dfs(v, u);
        cmax(fi, se, f[v]);
    }
    res = max(res, se + (f[u] = fi + (c[u] ^ (deg[u] & 1) ^ 1)));
}

int main() {
#ifdef isLOCAL
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;
    for (int i = 1, u, v; i < n; ++i)
        scanf("%d%d", &u, &v),
        addE(u, v), addE(v, u),
        deg[u]++, deg[v]++;

    int numw = 0;
    for (int i = 1; i <= n; ++i) {
        char ch = getchar();
        while (ch != 'W' && ch != 'B')
            ch = getchar();
        c[i] = (ch == 'B');
        numw += !c[i];
        if (deg[i] == 1 && c[i]) q.push(i);
    }

    if (numw <= 1) return cout << numw << endl, 0;

    int dlt = 0;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        ers[u] = 1, ++dlt;
        for (int i = fir[u], v; i; i = nxt[i]) {
            v = to[i];
            if (ers[v]) continue;
            if ((--deg[v]) == 1 && c[v])
                q.push(v);
        }
    }

    for (rt = 1; rt <= n && ers[rt]; ++rt);

    int ans = (n - 1 - dlt) * 2;

    for (int i = 1; i <= n; ++i)
        if (!ers[i]) ans += (deg[i] & 1) ^ c[i] ^ 1;

//    cout << ans << endl;

    dfs(rt);

//    cout << res << endl;

    cout << ans - res * 2 << endl;

    return 0;
}
