#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int i, j, k;
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  vector<vector<int>> g(n + 1, vector<int>());
  for (i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  queue<int> q;
  vector<int> vis(n + 1, -1);
  vector<int> a(n + 1, 0), b(n + 1, 0);
  vis[s] = 1;
  q.push(s);
  int d = 0;
  while (!q.empty()) {
    int z = q.size();
    while (z--) {
      int x = q.front();
      q.pop();
      a[x] = d;
      for (i = 0; i < g[x].size(); i++) {
        if (vis[g[x][i]] != 1) {
          vis[g[x][i]] = 1;
          q.push(g[x][i]);
        }
      }
    }
    d++;
  }
  queue<int> q1;
  vector<int> vis1(n + 1, -1);
  vis1[t] = 1;
  q1.push(t);
  d = 0;
  while (!q1.empty()) {
    int z = q1.size();
    while (z--) {
      int x = q1.front();
      q1.pop();
      b[x] = d;
      for (i = 0; i < g[x].size(); i++) {
        if (vis1[g[x][i]] != 1) {
          vis1[g[x][i]] = 1;
          q1.push(g[x][i]);
        }
      }
    }
    d++;
  }
  int c = 0;
  int min = a[t];
  for (i = 1; i <= n; i++) {
    for (j = i + 1; j <= n; j++) {
      int f = 0;
      for (k = 0; k < g[i].size(); k++) {
        if (g[i][k] == j) {
          f = 1;
          break;
        }
      }
      if (f == 1) continue;
      if (a[i] + b[j] + 1 >= min && a[j] + b[i] + 1 >= min) {
        c++;
      }
    }
  }
  cout << c;
  return 0;
}
