#include <bits/stdc++.h>
using namespace std;
using namespace std;
set<int> adj[1005];
int dist[1005], diss[1005];
int n, m, s, t;
void bfs() {
  for (int i = 0; i < 1005; i++) {
    dist[i] = diss[i] = -1;
  }
  queue<int> q;
  q.emplace(s);
  diss[s] = 0;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int u : adj[v]) {
      if (diss[u] == -1) {
        diss[u] = diss[v] + 1;
        q.emplace(u);
      }
    }
  }
  q.emplace(t);
  dist[t] = 0;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int u : adj[v]) {
      if (dist[u] == -1) {
        dist[u] = dist[v] + 1;
        q.emplace(u);
      }
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 0; i < m; i++) {
    int s, d;
    scanf("%d%d", &s, &d);
    adj[s].insert(d);
    adj[d].insert(s);
  }
  int cnt = 0;
  bfs();
  for (int i = 1; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if (adj[i].count(j)) {
        continue;
      }
      if (diss[t] <= min(diss[i] + 1 + dist[j], diss[j] + 1 + dist[i])) {
        cnt++;
      }
    }
  }
  cout << cnt;
}
