#include <bits/stdc++.h>
using namespace std;
void Draganov47() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int MAX = 1005;
vector<int> g[MAX];
int ds[MAX], df[MAX];
struct ver {
  int u, d;
};
int n, m, s, f;
int main() {
  Draganov47();
  cin >> n >> m >> s >> f;
  set<pair<int, int> > ok;
  for (int i = 0; i < m; i++) {
    int v1, v2;
    cin >> v1 >> v2;
    g[v1].push_back(v2);
    g[v2].push_back(v1);
    ok.insert({min(v1, v2), max(v1, v2)});
  }
  for (int i = 0; i < MAX; i++) ds[i] = 1e9, df[i] = 1e9;
  queue<ver> q;
  ds[s] = 0;
  q.push({s, 0});
  while (q.size()) {
    ver u = q.front();
    q.pop();
    for (int j = 0; j < g[u.u].size(); j++) {
      int next = g[u.u][j];
      if (ds[next] == 1e9) {
        ds[next] = u.d + 1;
        q.push({next, u.d + 1});
      }
    }
  }
  queue<ver> q2;
  df[f] = 0;
  q2.push({f, 0});
  while (q2.size()) {
    ver u = q2.front();
    q2.pop();
    for (int j = 0; j < g[u.u].size(); j++) {
      int next = g[u.u][j];
      if (df[next] == 1e9) {
        df[next] = u.d + 1;
        q2.push({next, u.d + 1});
      }
    }
  }
  int ans = 0;
  for (int v1 = 1; v1 <= n; v1++) {
    for (int v2 = v1 + 1; v2 <= n; v2++) {
      if (ok.count({min(v1, v2), max(v1, v2)}) == 0 &&
          ((ds[f] <= ds[v1] + 1 + df[v2]) && (ds[f] <= ds[v2] + 1 + df[v1]))) {
        ans++;
      }
    }
  }
  cout << ans;
}
