#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1005];
int vis[1005] = {0}, vit[1005] = {0};
void solve() {
  int n, m, s, t, u, v, c = 0;
  queue<int> q;
  cin >> n >> m >> s >> t;
  int ds[1005], dt[1005];
  int mp[1005][1005];
  memset(mp, 0, sizeof(mp));
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    mp[u][v] = 1;
    mp[v][u] = 1;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  q.push(s);
  vis[s] = 1;
  ds[s] = 0;
  while (!q.empty()) {
    int z = q.front();
    q.pop();
    for (auto w : adj[z]) {
      if (!vis[w]) {
        vis[w] = 1;
        ds[w] = ds[z] + 1;
        q.push(w);
      }
    }
  }
  q.push(t);
  vit[t] = 1;
  dt[t] = 0;
  while (!q.empty()) {
    int z = q.front();
    q.pop();
    for (auto w : adj[z]) {
      if (!vit[w]) {
        vit[w] = 1;
        dt[w] = dt[z] + 1;
        q.push(w);
      }
    }
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if (mp[i][j] == 0)
        if (ds[i] + 1 + dt[j] >= ds[t] && dt[i] + 1 + ds[j] >= ds[t]) {
          c++;
        }
    }
  }
  cout << c << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
