#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int mat[1010][1010], dist[1010][1010];
vector<int> adj[1010];
int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    mat[u][v] = true;
    mat[v][u] = true;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) dist[i][j] = INF;
    dist[i][i] = 0;
    queue<int> q;
    q.push(i);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (auto v : adj[u]) {
        if (dist[i][v] > dist[i][u] + 1) {
          dist[i][v] = dist[i][u] + 1;
          q.push(v);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (mat[i][j]) continue;
      if (min(dist[s][i] + dist[j][t] + 1, dist[s][j] + dist[i][t] + 1) >=
          dist[s][t])
        ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
