#include <bits/stdc++.h>
using namespace std;
vector<set<int>> g;
vector<int> d1, d2;
int s, t;
int n, m;
const int INF = (int)1e9;
vector<int> bfs(int s) {
  vector<int> d(n, INF);
  d[s] = 0;
  queue<int> q;
  vector<bool> used(n);
  q.push(s);
  while (q.size() != 0) {
    int we = q.front();
    used[we] = 1;
    q.pop();
    for (auto el : g[we]) {
      if (d[el] > d[we] + 1) {
        q.push(el);
        d[el] = d[we] + 1;
      }
    }
  }
  return d;
}
int ans;
int main() {
  cin.sync_with_stdio(0);
  cin >> n >> m >> s >> t;
  s--, t--;
  g.resize(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].insert(b);
    g[b].insert(a);
  }
  d1 = bfs(s);
  d2 = bfs(t);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (g[i].find(j) != g[i].end()) continue;
      ans += (1 + d1[i] + d2[j] >= d1[t]) && (1 + d1[j] + d2[i] >= d1[t]);
    }
  }
  cout << ans << endl;
  return 0;
}
