#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1005];
int dt[1002], ds[1002];
bool visited[1003] = {0};
void bfs1(int s) {
  queue<int> Q;
  Q.push(s);
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i];
      if (!visited[v]) {
        visited[v] = 1;
        ds[v] = ds[u] + 1;
        Q.push(v);
      }
    }
  }
}
void bfs2(int s) {
  queue<int> Q;
  Q.push(s);
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i];
      if (!visited[v]) {
        visited[v] = 1;
        dt[v] = dt[u] + 1;
        Q.push(v);
      }
    }
  }
}
int arr[1001][1001];
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;
    adj[u].push_back(v);
    adj[v].push_back(u);
    arr[u][v] = arr[v][u] = 1;
  }
  visited[s] = 1;
  ds[s] = dt[t] = 0;
  bfs1(s);
  memset(visited, 0, sizeof(visited));
  visited[t] = 1;
  bfs2(t);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j || arr[i][j] == 1) continue;
      int d = min(ds[i] + dt[j] + 1, ds[j] + 1 + dt[i]);
      if (d >= ds[t]) {
        ans++;
      }
    }
  }
  cout << ans / 2 << endl;
  return 0;
}
