#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 1010, M = 2e4;
int n, m, s, t, cnt, hd[N], mp[N][N];
struct edg {
  int nxt, to;
} e[M];
inline void ins(int u, int v) {
  e[++cnt] = (edg){hd[u], v};
  hd[u] = cnt;
}
struct node {
  int s, sgt, dis[N], tr[N * 4];
  void build() {
    sgt = 1;
    while (sgt <= n) sgt <<= 1;
    --sgt;
    memset(dis, 0x7f, sizeof(dis));
  }
  int cmp(const int &a, const int &b) { return dis[a] < dis[b] ? a : b; }
  void mdy(int x, int w) {
    dis[x] = w;
    int i = x + sgt;
    while (dis[tr[i]] > w && i) tr[i] = x, i >>= 1;
  }
  void del(int x) {
    x += sgt;
    tr[x] = 0;
    x >>= 1;
    while (x) tr[x] = cmp(tr[x << 1], tr[x << 1 | 1]), x >>= 1;
  }
  void dijkstra() {
    build();
    mdy(s, 0);
    while (tr[1]) {
      int x = tr[1];
      del(x);
      for (int i = hd[x]; i; i = e[i].nxt)
        if (dis[e[i].to] > dis[x] + 1) mdy(e[i].to, dis[x] + 1);
    }
  }
} ss, tt;
int main() {
  n = read();
  m = read();
  s = read();
  t = read();
  for (int i = 1; i <= m; ++i) {
    int u = read(), v = read();
    mp[u][v] = mp[v][u] = 1;
    ins(u, v);
    ins(v, u);
  }
  ss.s = s;
  tt.s = t;
  ss.dijkstra();
  tt.dijkstra();
  int len = ss.dis[t], ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (!mp[i][j]) {
        int x = min(ss.dis[i] + tt.dis[j], ss.dis[j] + tt.dis[i]) + 1;
        if (x >= len) ++ans;
      }
  printf("%d\n", ans);
  return 0;
}
