#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 1010;
struct node {
  int v, next;
} g[2 * M];
int tong[N][N], init[N], dis1[N], dis2[N], tot, head[N];
queue<int> q;
int main() {
  int n, m, s, t, u, v;
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    g[++tot].v = v;
    g[tot].next = head[u];
    head[u] = tot;
    g[++tot].v = u;
    g[tot].next = head[v];
    head[v] = tot;
    tong[u][v] = tong[v][u] = 1;
  }
  for (int i = 1; i <= n; i++) dis1[i] = 1 << 30;
  q.push(s);
  init[s] = 1;
  dis1[s] = 0;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    init[u] = 0;
    for (int i = head[u]; i; i = g[i].next) {
      int v = g[i].v;
      if (dis1[u] + 1 < dis1[v]) {
        dis1[v] = dis1[u] + 1;
        if (!init[v]) {
          init[v] = 1;
          q.push(v);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) init[i] = 0;
  for (int i = 1; i <= n; i++) dis2[i] = 1 << 30;
  dis2[t] = 0;
  q.push(t);
  init[t] = 1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    init[u] = 0;
    for (int i = head[u]; i; i = g[i].next) {
      int v = g[i].v;
      if (dis2[u] + 1 < dis2[v]) {
        dis2[v] = dis2[u] + 1;
        if (!init[v]) {
          init[v] = 1;
          q.push(v);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (i >= j) continue;
      if ((!tong[i][j]) && (dis1[i] + dis2[j] + 1 >= dis1[t] &&
                            dis1[j] + dis2[i] + 1 >= dis1[t]))
        ans++;
    }
  printf("%d", ans);
}
