#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a, T b) {
  for (; a != b; ++a) cerr << *a << ' ';
  cerr << endl;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
char s[200005];
int n;
vector<int> g[200005];
int size[200005], dist[200005];
long long int sumd[200005];
void dfs(int v, int p) {
  size[v] = 1;
  dist[v] = 0;
  for (auto to : g[v]) {
    if (to == p) continue;
    dfs(to, v);
    size[v] += size[to];
    sumd[v] += sumd[to] + size[to];
    chmax(dist[v], dist[to] + 1);
  }
}
long long int add = 0;
long long int dfs3(int v, int p, int down) {
  pair<int, int> most, sec;
  most = sec = make_pair(-1, -1);
  most.second = down;
  sec.second = 0;
  for (auto to : g[v]) {
    if (to == p) continue;
    int val = dist[to] + 1;
    if (most.second < val) {
      sec = most;
      most = make_pair(to, val);
    } else if (sec.second < val) {
      sec = make_pair(to, val);
    }
  }
  long long int res = sec.second + 1;
  cerr << "v"
       << " = " << (v) << endl;
  if (~p && down - 1 != dist[v]) ++add;
  if (p == -1 && (most.second + sec.second) & 1) ++add;
  for (auto to : g[v]) {
    if (to == p) continue;
    int d;
    if (to == most.first) {
      d = sec.second + 1;
    } else {
      d = most.second + 1;
    }
    res += dfs3(to, v, d);
  }
  return res;
}
int main() {
  cin >> n;
  for (int i = 0; i < (n - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  scanf("%s", s);
  dfs(0, -1);
  long long int res = dfs3(0, -1, 0);
  res += add;
  assert(add >= n - 1);
  cout << res << endl;
  return 0;
}
