#include <bits/stdc++.h>
using namespace std;
int n, m, s, t, u, v;
vector<int> adjlist[1005];
int shortestpath[1005][1005];
int ans = 0;
bool connected(int a, int b) {
  bool connected = false;
  if (a == b) return true;
  for (int v : adjlist[a]) {
    if (v == b) connected = true;
  }
  return connected;
}
void bfs(int s) {
  queue<int> q;
  q.push(s);
  shortestpath[s][s] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : adjlist[u]) {
      if (shortestpath[s][v] == -1) {
        shortestpath[s][v] = shortestpath[s][u] + 1;
        q.push(v);
      }
    }
  }
}
int main() {
  cin >> n >> m >> s >> t;
  memset(shortestpath, -1, sizeof(shortestpath));
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    adjlist[u].push_back(v);
    adjlist[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) bfs(i);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if ((shortestpath[s][i] + 1 + shortestpath[j][t]) >= shortestpath[s][t] &&
          !connected(i, j) &&
          (shortestpath[s][j] + 1 + shortestpath[i][t]) >= shortestpath[s][t]) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
