#include <bits/stdc++.h>
using namespace std;
int n, m, s, t;
set<int> adj[1005];
int dis1[1005], dis2[1005];
void BFS(int st) {
  fill(dis1, dis1 + 1001, -1);
  queue<int> q;
  q.push(st);
  dis1[st] = 0;
  while (!q.empty()) {
    auto a = q.front();
    q.pop();
    for (auto i : adj[a]) {
      if (dis1[i] == -1) {
        dis1[i] = dis1[a] + 1;
        q.push(i);
      }
    }
  }
}
int main() {
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].insert(v);
    adj[v].insert(u);
  }
  BFS(t);
  for (int i = 1; i <= n; ++i) dis2[i] = dis1[i];
  BFS(s);
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (adj[i].find(j) != adj[i].end()) continue;
      if (dis1[i] + dis2[j] < dis1[t] - 1) continue;
      if (dis2[i] + dis1[j] < dis1[t] - 1) continue;
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}
