#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int iinf = INT_MAX / 2;
const long long linf = LONG_MAX / 2;
const int MOD = 1e9 + 7;
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
int n, m, S, T, A, B, C, D1, D2, ANS;
int used[N][3], dis[N][3], a[N][N];
struct node {
  int to, c;
  bool operator<(const node &r) const { return r.c < c; }
};
vector<int> q[N];
void Dij(int s, int c) {
  for (int i = 1; i <= n; i++) dis[i][c] = iinf;
  dis[s][c] = 0;
  priority_queue<node> que;
  que.push((node){s, 0});
  while (!que.empty()) {
    node t = que.top();
    que.pop();
    int u = t.to;
    if (used[u][c]) continue;
    used[u][c] = 1;
    for (int i = 0; i < q[u].size(); i++) {
      int v = q[u][i];
      if (!used[v][c] && dis[v][c] > dis[u][c] + 1) {
        dis[v][c] = dis[u][c] + 1;
        que.push((node){v, dis[v][c]});
      }
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &S, &T);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &A, &B);
    a[B][A] = a[A][B] = 1;
    q[A].push_back(B);
    q[B].push_back(A);
  }
  Dij(S, 1);
  Dij(T, 2);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!a[i][j]) {
        D1 = dis[i][1] + dis[j][2] + 1;
        D2 = dis[i][2] + dis[j][1] + 1;
        if (min(D1, D2) >= dis[T][1]) ANS++;
      }
  printf("%d\n", ANS);
}
