#include <bits/stdc++.h>
using namespace std;
int n, m, S, T;
int Head[1001], To[2001], Next[2001], t1 = 0;
int dis[2][1001];
bool vis[1001];
bool r[1001][1001] = {false};
int ans = 0;
struct que {
  int d, id;
  bool operator<(const que& a) const { return a.d < d; }
} t;
priority_queue<que> q;
void add(int u, int v) {
  t1++;
  Next[t1] = Head[u];
  Head[u] = t1;
  To[t1] = v;
}
void H(int c, int A) {
  for (int i = 1; i <= n; i++) vis[i] = false;
  t.d = 0;
  t.id = A;
  q.push(t);
  dis[c][A] = 0;
  while (!q.empty()) {
    while (!q.empty() && vis[q.top().id]) q.pop();
    if (q.empty()) break;
    int t2 = q.top().id;
    vis[t2] = true;
    q.pop();
    for (int i = Head[t2]; i != 0; i = Next[i]) {
      if (!vis[To[i]]) {
        if (dis[c][To[i]] > dis[c][t2] + 1) {
          dis[c][To[i]] = dis[c][t2] + 1;
          t.d = dis[c][To[i]];
          t.id = To[i];
          q.push(t);
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &S, &T);
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
    r[u][v] = r[v][u] = true;
  }
  for (int i = 1; i <= n; i++) dis[0][i] = dis[1][i] = 5000;
  H(0, S);
  H(1, T);
  for (int i = 1; i <= n; i++) {
    for (int k = i + 1; k <= n; k++) {
      if (r[i][k]) continue;
      int t3, t4, t5;
      if (dis[0][i] + 1 + dis[1][k] >= dis[0][T] &&
          dis[0][k] + 1 + dis[1][i] >= dis[0][T])
        ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
