#include <bits/stdc++.h>
using namespace std;
void amax(long long &a, long long b) { a = max(a, b); }
void amin(long long &a, long long b) { a = min(a, b); }
const long long INF = 1e9;
vector<pair<long long, long long> > g[600001];
long long cost[600001];
long long visit[600001];
vector<long long> disk(long long start, long long n) {
  vector<long long> cost(n + 1);
  for (long long i = 0; i < n + 1; i++) {
    cost[i] = INF;
    visit[i] = 0;
  }
  set<pair<long long, long long> > s;
  s.insert(make_pair(0, start));
  cost[start] = 0;
  while (!s.empty()) {
    auto it = s.begin();
    long long curr = it->second;
    s.erase(it);
    if (visit[curr]) continue;
    visit[curr] = 1;
    for (pair<long long, long long> tmp : g[curr]) {
      long long next = tmp.first;
      long long w = tmp.second;
      if (!visit[next] && cost[next] > w + cost[curr]) {
        cost[next] = w + cost[curr];
        s.insert(make_pair(cost[next], next));
      }
    }
  }
  return cost;
}
void solve() {
  long long n, m, s, t;
  cin >> n >> m >> s >> t;
  long long p[n + 1][n + 1];
  memset(p, 0, sizeof(p));
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(make_pair(v, 1));
    g[v].push_back(make_pair(u, 1));
    p[u][v] = p[v][u] = 1;
  }
  vector<long long> dis_s = disk(s, n);
  vector<long long> dis_t = disk(t, n);
  long long dis = dis_s[t], ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = i + 1; j < n + 1; j++) {
      if (!p[i][j]) {
        long long mn = min(dis_s[i] + dis_t[j], dis_t[i] + dis_s[j]);
        if (mn + 1 >= dis) {
          ans++;
        }
      }
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
