#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int inf = 0x7fffffff;
int n, m, s, t, ans;
int vis[N][3], dis[N][3];
bool mp[N][N];
vector<int> g[N];
struct Edge {
  int to, nxt;
  Edge() {}
  Edge(int _to, int _nxt) { to = _to, nxt = _nxt; }
  bool operator<(const Edge &oth) const { return nxt >= oth.nxt; }
};
void Dijkstra(int s, int k) {
  for (int i = 1; i <= n; i++) dis[i][k] = inf;
  dis[s][k] = 0;
  priority_queue<Edge> q;
  q.push(Edge(s, 0));
  while (!q.empty()) {
    Edge u = q.top();
    q.pop();
    int now = u.to;
    if (vis[now][k]) continue;
    for (int i = 0; i < g[now].size(); i++) {
      int v = g[now][i];
      if (!vis[v][k] && dis[v][k] > dis[now][k] + 1) {
        dis[v][k] = dis[now][k] + 1;
        q.push(Edge(v, dis[v][k]));
      }
    }
  }
}
int main() {
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    mp[u][v] = mp[v][u] = true;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  Dijkstra(s, 1);
  Dijkstra(t, 2);
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!mp[i][j]) {
        int dist1 = dis[i][1] + dis[j][2] + 1;
        int dist2 = dis[i][2] + dis[j][1] + 1;
        if (min(dist1, dist2) >= dis[t][1]) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
