#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int, int>>>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void dfs(Graph& G, vector<long long>& dist, int now) {
  for (auto i : G[now]) {
    if (dist[i] != -1) continue;
    dist[i] = dist[now] + 1;
    dfs(G, dist, i);
  }
  return;
}
int solve() {
  int n, u, v;
  cin >> n >> u >> v;
  u--;
  v--;
  Graph G(n);
  for (int i = 0; i < (n - 1); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<long long> distu(n, -1), distv(n, -1);
  distu[u] = 0;
  dfs(G, distu, u);
  distv[v] = 0;
  dfs(G, distv, v);
  long long ans = 0, cnt = 0, zero = 0;
  for (int i = 0; i < (n); ++i) {
    distv[i] -= distu[i];
    if (distv[i] > 0) cnt++;
    if (distv[i] == 0) zero++;
  }
  if (zero >= 1)
    cout << cnt << endl;
  else
    cout << cnt - 1 << endl;
  return 0;
}
int main() {
  solve();
  return 0;
}
