#include <bits/stdc++.h>
using namespace std;
vector<int> s[1010];
int q[101010], vis[1010][1010], vis2[101010], f[1010], g[1010];
int main() {
  int n, m, j, i, st, en, h, t, x, y, c, ans;
  scanf("%d%d%d%d", &n, &m, &st, &en);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    s[x].push_back(y);
    s[y].push_back(x);
    vis[x][y] = 1;
    vis[y][x] = 1;
  }
  h = 0, t = 1, q[h] = st, vis2[st] = 1, f[st] = 0;
  while (h < t) {
    x = q[h];
    h++;
    c = s[x].size();
    for (i = 0; i < c; i++) {
      y = s[x][i];
      if (vis2[y] == 1) continue;
      vis2[y] = 1;
      f[y] = f[x] + 1;
      q[t] = y;
      t++;
    }
  }
  memset(vis2, 0, sizeof(vis2));
  h = 0, t = 1, q[h] = en, vis2[en] = 1, g[en] = 0;
  while (h < t) {
    x = q[h];
    h++;
    c = s[x].size();
    for (i = 0; i < c; i++) {
      y = s[x][i];
      if (vis2[y] == 1) continue;
      vis2[y] = 1;
      g[y] = g[x] + 1;
      q[t] = y;
      t++;
    }
  }
  ans = 0;
  for (i = 1; i <= n; i++) {
    for (j = i + 1; j <= n; j++) {
      if (vis[i][j] == 0)
        if (!(f[i] + 1 + g[j] < f[en] || f[j] + 1 + g[i] < f[en])) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
