#include <bits/stdc++.h>
using namespace std;
bool path[1001][1001];
int pr[10001], d[10001], dn[10001], prn[10001];
int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  vector<int> a[n + 1];
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
    path[x][y] = true;
    path[y][x] = true;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    d[i] = INT_MAX;
    dn[i] = INT_MAX;
    for (int j = i + 1; j <= n; j++) {
      if (!path[i][j]) ans++;
    }
  }
  vector<int> q;
  q.push_back(s);
  int i = 0;
  d[s] = 0;
  while (i < q.size()) {
    int x = q[i];
    for (int j = 0; j < a[x].size(); j++) {
      int y = a[x][j];
      if (d[y] > d[x] + 1) {
        d[y] = d[x] + 1;
        q.push_back(y);
      }
    }
    i++;
  }
  q.clear();
  q.push_back(t);
  i = 0;
  dn[t] = 0;
  while (i < q.size()) {
    int x = q[i];
    for (int j = 0; j < a[x].size(); j++) {
      int y = a[x][j];
      if (dn[y] > dn[x] + 1) {
        dn[y] = dn[x] + 1;
        q.push_back(y);
      }
    }
    i++;
  }
  int mn = d[t];
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++)
      if (!path[i][j]) {
        if (d[i] + 1ll + dn[j] < mn)
          ans--;
        else if (d[j] + 1ll + dn[i] < mn)
          ans--;
      }
  }
  cout << ans;
  return 0;
}
