#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[300005];
long long int dist[300005], vis[300005], flow1[300005], bee1[300005],
    flow2[300005], bee2[300005];
int main() {
  long long int n, x, y;
  cin >> n >> x >> y;
  for (long long int i = 0; i < n - 1; i++) {
    long long int f, g;
    cin >> f >> g;
    adj[f].push_back(g);
    adj[g].push_back(f);
  }
  queue<long long int> q;
  q.push(x);
  for (long long int i = 1; i <= n; i++) dist[i] = 1000000005;
  dist[x] = 0;
  flow1[x] = 1;
  while (!q.empty()) {
    long long int f = q.front();
    q.pop();
    for (long long int i = 0; i < adj[f].size(); i++) {
      long long int g = adj[f][i];
      if (dist[g] < dist[f] + 1) continue;
      if (dist[g] == dist[f] + 1) {
        if (flow1[f]) continue;
      }
      dist[g] = dist[f] + 1;
      q.push(g);
      if (flow1[f]) flow1[g] = 1;
      if (bee1[f] || g == y) bee1[g] = 1;
    }
  }
  long long int cbee = 0, cflow = 0, cflowbee = 0, cbeeflow = 0;
  for (long long int i = 1; i <= n; i++) {
    if (flow1[i] && !bee1[i]) cflow++;
    if (flow1[i] && bee1[i]) cflowbee++;
  }
  long long int ans = cflow * (cflow - 1);
  q.push(y);
  for (long long int i = 1; i <= n; i++) dist[i] = 1000000005;
  dist[y] = 0;
  bee2[y] = 1;
  while (!q.empty()) {
    long long int f = q.front();
    q.pop();
    for (long long int i = 0; i < adj[f].size(); i++) {
      long long int g = adj[f][i];
      if (dist[g] < dist[f] + 1) continue;
      if (dist[g] == dist[f] + 1) {
        if (bee2[f]) continue;
      }
      dist[g] = dist[f] + 1;
      q.push(g);
      if (flow2[f] || g == x) flow2[g] = 1;
      if (bee2[f]) bee2[g] = 1;
    }
  }
  long long int beech = 0;
  for (long long int i = 1; i <= n; i++) {
    if (!flow2[i] && bee2[i]) cbee++;
    if (flow2[i] && bee2[i]) cbeeflow++;
    if (flow1[i] && !flow2[i] && !bee1[i] && bee2[i]) beech++;
  }
  ans += cbee * (cbee - 1);
  ans += cflowbee * cbeeflow;
  ans -= beech * (beech - 1);
  cout << ans;
  return 0;
}
