/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class FMonochromeCat {
public:

    vector<int> graph[100005];
    vector<bool> isBlack;
    vector<ll> go;
    vector<ll> back;
    vector<ll> ret;

    void dfs1(int v, int pa) {
      ll ma = 0;
      ll b = 0;
      ll deg = 0;
      for(auto e: graph[v]) {
        if (e == pa) continue;
        dfs1(e, v);
        b += back[e];
        chmax(ma, back[e] - go[e]);
        if (back[e] > 0) deg++;
      }
      if (b == 0 && isBlack[v]) {
        return;
      }
      if (b == 0 && !isBlack[v]) {
        back[v] = 2;
        go[v] = 1;
        return;
      }

      b += 2;
      ll g = b-1-ma;
      if ((deg%2==0) ^ isBlack[v]) {
        g++;
      } else {
        b++;
      }
      go[v] = g;
      back[v] = b;
      debug(v, go[v], back[v]);
    }

    void dfs2(int v, int pa, ll g, ll b) {

      vector<int> vec;
      int deg = 0;
      if (b > 0) {
        vec.push_back(b - g);
        deg++;
      }
      ll sumb = b;
      for(auto e: graph[v]) {
        if (e == pa) continue;
        if (back[e] == 0) continue;
        vec.push_back(back[e] - go[e]);
        sumb += back[e];
        deg++;
      }
      sort(vec.rbegin(), vec.rend());

      if (deg == 1) {
        ret[v] = sumb - vec[0];
        if (isBlack[v]) ret[v] = LLONG_MAX;
        debug(v, ret[v]);
      } else {
        // should not an answer;
        ret[v] = LLONG_MAX;
      }

      for(auto e: graph[v]) {
        if (e == pa) continue;
        if (back[e] == 0) continue;
        // calc b and g of the parent
        ll d = 0;
        if (vec.size() > 1) {
          d = vec[0];
          if (vec[0] == (back[e] - go[e])) {
            // use 2nd largest
            d = vec[1];
          }
        }
        ll bb = sumb - back[e];
        bb += 2;
        ll gg = bb - 1 - d;
        if ((deg%2==0) ^ isBlack[v]) {
          bb++;
        } else {
          gg++;
        }
        dfs2(e, v, gg, bb);
      }

    }


    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      debug(n);
      isBlack.resize(n);
      go.resize(n);
      back.resize(n);
      ret.resize(n);
      rep(i, n-1) {
        int a, b; cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
      }
      int root = -1;
      int whiteCnt = 0;
      rep(i, n) {
        char c; cin >> c;
        isBlack[i] = (c == 'B');
        if (!isBlack[i]) {
          root = i;
          whiteCnt++;
        }
      }
      // All black
      if (whiteCnt <= 1) {
        cout << whiteCnt << endl;
        return;
      }

      dfs1(root, -1);
      dfs2(root, -1, 0, 0);

      ll ans = LLONG_MAX;
      rep(i, n) {
        if (!isBlack[i]) {
          chmin(ans, ret[i]);
        }
      }
      cout << ans+1 << endl;
    }
};

signed main() {
  FMonochromeCat solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 23680