#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int>> pq;
int dists[1100];
vector<vector<int>> vt;
int distt[1100];
int iscon[1100][1100];
int n, m, s, t;
int a, b;
string str;
int visited[110];
int main() {
  memset(dists, -1, sizeof(dists));
  memset(distt, -1, sizeof(distt));
  scanf("%d %d %d %d", &n, &m, &s, &t);
  vt.resize(n + 1);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    vt[a].push_back(b);
    vt[b].push_back(a);
    iscon[a][b] = 1;
    iscon[b][a] = 1;
  }
  pq.push({0, s});
  while (pq.size()) {
    int xv = pq.top().second;
    int c = -pq.top().first;
    pq.pop();
    if (dists[xv] != -1) continue;
    dists[xv] = c;
    for (auto nv : vt[xv]) {
      if (dists[nv] != -1) continue;
      pq.push({-(c + 1), nv});
    }
  }
  while (pq.size()) pq.pop();
  pq.push({0, t});
  while (pq.size()) {
    int xv = pq.top().second;
    int c = -pq.top().first;
    pq.pop();
    if (distt[xv] != -1) continue;
    distt[xv] = c;
    for (auto nv : vt[xv]) {
      if (distt[nv] != -1) continue;
      pq.push({-(c + 1), nv});
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!iscon[i][j]) {
        if (dists[i] + distt[j] + 1 >= dists[t] &&
            dists[j] + distt[i] + 1 >= dists[t]) {
          ans++;
        }
      }
    }
  }
  printf("%d", ans);
}
