#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
int n, m, s, t, ans;
int ds[N], dt[N];
bool a[N][N];
vector<vector<int> > edges(N);
int main() {
  cin >> n >> m >> s >> t;
  for (int i = (0), i_end_ = (m); i < i_end_; ++i) {
    int fm, to;
    cin >> fm >> to;
    a[fm][to] = a[to][fm] = true;
    edges[fm].push_back(to);
    edges[to].push_back(fm);
  }
  memset(ds, 0x3f, sizeof ds);
  memset(dt, 0x3f, sizeof dt);
  queue<int> q;
  q.push(s);
  ds[s] = 0;
  while (!q.empty()) {
    int temp = q.front();
    q.pop();
    for (int i = (0), i_end_ = (edges[temp].size()); i < i_end_; ++i) {
      int cur = edges[temp][i];
      if (ds[cur] == 0x3f3f3f3f) {
        ds[cur] = ds[temp] + 1;
        q.push(cur);
      }
    }
  }
  q.push(t);
  dt[t] = 0;
  while (!q.empty()) {
    int temp = q.front();
    q.pop();
    for (int i = (0), i_end_ = (edges[temp].size()); i < i_end_; ++i) {
      int cur = edges[temp][i];
      if (dt[cur] == 0x3f3f3f3f) {
        dt[cur] = dt[temp] + 1;
        q.push(cur);
      }
    }
  }
  for (int i = (1), i_end_ = (n + 1); i < i_end_; ++i) {
    for (int j = (i + 1), j_end_ = (n + 1); j < j_end_; ++j) {
      if (a[i][j]) continue;
      int dist = min(ds[i] + dt[j], ds[j] + dt[i]) + 1;
      if (dist >= ds[t]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
