#include <bits/stdc++.h>
using namespace std;
int n, m, s, t;
int ds[1010], dt[1010];
struct node {
  vector<int> adj;
  bool vis = false;
};
node graph[1010];
void bfss() {
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    graph[cur].vis = true;
    for (int i = 0; i < graph[cur].adj.size(); i++) {
      int val = graph[cur].adj[i];
      if (graph[val].vis == false && ds[val] == -1) {
        ds[val] = 1 + ds[cur];
        q.push(val);
      }
    }
  }
}
void bfst() {
  queue<int> q;
  q.push(t);
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    graph[cur].vis = true;
    for (int i = 0; i < graph[cur].adj.size(); i++) {
      int val = graph[cur].adj[i];
      if (graph[val].vis == false && dt[val] == -1) {
        dt[val] = 1 + dt[cur];
        q.push(val);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int pre[1010][1010];
  for (int i = 0; i < 1010; i++) {
    for (int j = 0; j < 1010; j++) {
      pre[i][j] = 0;
    }
  }
  for (int i = 0; i < 1010; i++) {
    ds[i] = -1;
    dt[i] = -1;
  }
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    graph[a].adj.push_back(b);
    graph[b].adj.push_back(a);
    pre[a][b] = 1;
    pre[b][a] = 1;
  }
  ds[s] = 0;
  dt[t] = 0;
  bfss();
  for (int i = 1; i <= n; i++) {
    graph[i].vis = false;
  }
  bfst();
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (pre[i][j] == 0) {
        bool a1 = (ds[i] + dt[j] + 1 >= ds[t]);
        bool a2 = (ds[j] + dt[i] + 1 >= ds[t]);
        if (a1 && a2) {
          ans++;
        }
      }
    }
  }
  cout << ans;
}
