#include <bits/stdc++.h>
using namespace std;
int a[1010][1010];
priority_queue<int> q;
void dijsktra(int start, int N, int d[1010]) {
  int i, j;
  bool v[1010];
  memset(v, 0, sizeof(v));
  d[start] = 0;
  for (i = 1; i < N; i++) {
    int x = 0;
    for (j = 1; j <= N; j++)
      if (!v[j] && (x == 0 || d[j] < d[x])) x = j;
    v[x] = 1;
    for (j = 1; j <= N; j++) {
      d[j] = min(d[j], d[x] + a[x][j]);
    }
  }
}
int main() {
  int N, M, S, T;
  int temp_x, temp_y;
  while (scanf("%d%d%d%d", &N, &M, &S, &T) == 4) {
    int i, j;
    memset(a, 0x3f, sizeof(a));
    for (i = 0; i <= N; i++) a[i][i] = 0;
    for (i = 0; i < M; i++) {
      scanf("%d%d", &temp_x, &temp_y);
      a[temp_x][temp_y] = 1;
      a[temp_y][temp_x] = 1;
    }
    int dt[1010], ds[1010];
    memset(ds, 0x3f, sizeof(ds));
    memset(dt, 0x3f, sizeof(dt));
    dijsktra(T, N, dt);
    dijsktra(S, N, ds);
    int length = ds[T];
    int count = 0;
    for (i = 1; i <= N; i++) {
      for (j = i + 1; j <= N; j++) {
        if (a[i][j] == 1) continue;
        if (ds[i] + dt[j] + 1 >= length && ds[j] + dt[i] + 1 >= length) {
          count++;
        }
      }
    }
    printf("%d\n", count);
  }
}
