#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n;
int ds[N], dt[N];
vector<int> g[N];
void bfs(int st, int *d) {
  for (int i = 1; i <= n; i++) d[i] = -1;
  d[st] = 0;
  queue<int> q;
  q.push(st);
  int u;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (int v : g[u])
      if (d[v] == -1) {
        d[v] = d[u] + 1;
        q.push(v);
      }
  }
}
int mat[N][N];
int main() {
  int m, s, t;
  scanf("%d %d %d %d", &n, &m, &s, &t);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    mat[a][b] = 1;
    mat[b][a] = 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bfs(s, ds), bfs(t, dt);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++)
      if (!mat[i][j]) {
        if (min(ds[i] + 1 + dt[j], ds[j] + 1 + dt[i]) >= ds[t]) ans++;
      }
  }
  printf("%d\n", ans);
}
