#include <bits/stdc++.h>
using namespace std;
bool g[1010][1010];
int n, m, s, t, ds[1010], dt[1010];
void bfs(int s, int *d) {
  for (register int i = 1; i <= n; i++) d[i] = -1;
  queue<int> q;
  q.push(s);
  d[s] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (register int i = 1; i <= n; i++) {
      if (g[u][i] && d[i] == -1) {
        d[i] = d[u] + 1;
        q.push(i);
      }
    }
  }
}
int main() {
  scanf("%d %d %d %d", &n, &m, &s, &t);
  for (register int i = 0; i < m; i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    g[x][y] = 1;
    g[y][x] = 1;
  }
  bfs(s, ds);
  bfs(t, dt);
  int cnt = 0;
  for (register int i = 1; i <= n; i++) {
    for (register int j = i + 1; j <= n; j++) {
      if (!g[i][j]) {
        if (ds[i] + dt[j] + 1 < ds[t] || ds[j] + dt[i] + 1 < ds[t]) continue;
        cnt++;
      }
    }
  }
  printf("%d\n", cnt);
  return 0;
}
