#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000 + 7;
int main() {
  long n, m, s, f, a, b;
  cin >> n >> m >> s >> f;
  s--;
  f--;
  set<pair<int, int> > st;
  vector<vector<long> > g(n + 1);
  vector<char> u(n + 1);
  vector<long> d(n + 1), d1(n + 1);
  d.assign(n + 1, -INF);
  d1.assign(n + 1, -INF);
  for (long i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
    st.insert({a, b});
    st.insert({b, a});
  }
  queue<long> q;
  q.push(s);
  u[s] = true;
  d[s] = 0;
  while (!q.empty()) {
    long v = q.front();
    q.pop();
    for (long i = 0; i < g[v].size(); i++) {
      long to = g[v][i];
      if (!u[to]) {
        q.push(to);
        u[to] = true;
        d[to] = d[v] + 1;
      }
    }
  }
  u.assign(n + 1, false);
  queue<long> q1;
  q1.push(f);
  u[f] = true;
  d1[f] = 0;
  while (!q1.empty()) {
    long v = q1.front();
    q1.pop();
    for (long i = 0; i < g[v].size(); i++) {
      long to = g[v][i];
      if (!u[to]) {
        q1.push(to);
        u[to] = true;
        d1[to] = d1[v] + 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (i != j && min(d[i] + d1[j] + 1, d1[i] + d[j] + 1) >= d[f] &&
          !st.count({i, j})) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
}
