#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double PI = acos(-1);
const long long INF = LLONG_MAX;
const long long M = 1e5 + 10;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
void read(long long t[], long long n) {
  for (int i = 1; i <= n; ++i) {
    cin >> t[i];
  }
  return;
}
vector<pair<long long, long long> > G[M];
long long V, E;
bool vis[M] = {false};
bool vis2[M] = {false};
long long dist[M];
long long dist2[M];
void dijkestra(vector<pair<long long, long long> > G[M], long long scr) {
  for (int i = 1; i <= V; i++) dist[i] = INF;
  dist[scr] = 0;
  vis[scr] = true;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  q.push({0, scr});
  while (!q.empty()) {
    long long a = q.top().second;
    vis[a] = 1;
    if (dist[a] < q.top().first) {
      q.pop();
      continue;
    }
    q.pop();
    for (auto b : G[a]) {
      if (dist[a] + b.second < dist[b.first] && !vis[b.first]) {
        dist[b.first] = dist[a] + b.second;
        q.push({dist[b.first], b.first});
      }
    }
  }
}
void dijkestra2(vector<pair<long long, long long> > G[M], long long scr) {
  for (int i = 1; i <= V; i++) dist2[i] = INF;
  dist2[scr] = 0;
  vis2[scr] = true;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  q.push({0, scr});
  while (!q.empty()) {
    long long a = q.top().second;
    vis2[a] = 1;
    if (dist2[a] < q.top().first) {
      q.pop();
      continue;
    }
    q.pop();
    for (auto b : G[a]) {
      if (dist2[a] + b.second < dist2[b.first] && !vis2[b.first]) {
        dist2[b.first] = dist2[a] + b.second;
        q.push({dist2[b.first], b.first});
      }
    }
  }
}
long long ad1[1000 + 10][1000 + 10], ad2[1000 + 10][1000 + 10];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long start, go;
  cin >> V >> E >> start >> go;
  for (int i = 1; i <= E; ++i) {
    long long a1, a2;
    cin >> a1 >> a2;
    G[a1].push_back(make_pair(a2, 1));
    G[a2].push_back(make_pair(a1, 1));
    ad1[a1][a2] = 1;
    ad1[a2][a1] = 1;
  }
  dijkestra(G, start);
  dijkestra2(G, go);
  long long D = dist[go];
  long long ans = 0;
  for (int i = 1; i <= V; ++i) {
    for (int j = i + 1; j <= V; ++j) {
      if (ad1[i][j] == 0 &&
          !(dist[i] + dist2[j] + 1 < D || dist[j] + dist2[i] + 1 < D))
        ans++;
    }
  }
  cout << ans;
  return 0;
}
