#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long int llINF = 0x3f3f3f3f3f3f3f;
vector<int> nodes[1010];
int dist[1010];
int dist2[1010];
int edges[1010][1010];
void bfs(int v) {
  memset(dist, INF, sizeof(dist));
  dist[v] = 0;
  queue<int> fila;
  fila.push(v);
  while (!fila.empty()) {
    int pai = fila.front();
    fila.pop();
    for (auto x : nodes[pai]) {
      if (1 + dist[pai] < dist[x]) {
        fila.push(x);
        dist[x] = 1 + dist[pai];
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, s, d;
  cin >> n >> m >> s >> d;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    nodes[x].push_back(y);
    nodes[y].push_back(x);
    edges[x][y] = 1;
    edges[y][x] = 1;
  }
  bfs(d);
  for (int i = 1; i <= n; i++) dist2[i] = dist[i];
  bfs(s);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (edges[i][j]) continue;
      int d1 = 1 + dist[i] + dist2[j];
      int d2 = 1 + dist[j] + dist2[i];
      int new_d = min(d1, d2);
      if (new_d >= dist[d]) cnt++;
    }
  }
  cout << cnt << endl;
}
