#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1001, INF = 10000000;
int n, m, s, t, *ds, *dt;
bool used[MAXN], mt[MAXN][MAXN];
vector<int> g[MAXN];
void dejkstra(int *, int);
bool ok(int, int);
int main() {
  cin >> n >> m >> s >> t;
  s--;
  t--;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      mt[i][j] = 0;
    }
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
    mt[u][v] = mt[v][u] = 1;
  }
  ds = new int[MAXN];
  dt = new int[MAXN];
  dejkstra(ds, s);
  dejkstra(dt, t);
  int k = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      k += ok(i, j);
    }
  }
  cout << k << endl;
}
bool ok(int i, int j) {
  if (mt[i][j]) {
    return 0;
  }
  if (dt[i] < dt[j]) {
    swap(i, j);
  }
  return ds[i] + 1 + dt[j] >= ds[t];
}
void dejkstra(int *d, int s) {
  for (int i = 0; i < n; i++) {
    d[i] = INF;
  }
  d[s] = 0;
  for (int i = 0; i < n; i++) {
    used[i] = false;
  }
  for (int i = 0; i < n; i++) {
    int min = INF, min_index;
    for (int j = 0; j < n; j++) {
      if (!used[j] && min > d[j]) {
        min = d[j];
        min_index = j;
      }
    }
    for (int j = 0; j < g[min_index].size(); j++) {
      if (!used[g[min_index][j]] && d[g[min_index][j]] > d[min_index] + 1) {
        d[g[min_index][j]] = d[min_index] + 1;
      }
    }
    used[min_index] = true;
  }
}
