#include <bits/stdc++.h>
using namespace std;
int n, m, s, t, ds[1001], dt[1001];
;
vector<vector<int> > Adj;
void BFS(int ori, int d[]) {
  for (int i = 1; i <= n; i++) d[i] = 2 * n;
  d[ori] = 0;
  queue<int> Q;
  Q.push(ori);
  while (Q.size()) {
    int p = Q.front();
    Q.pop();
    for (auto k : Adj[p])
      if (d[p] + 1 < d[k]) d[k] = d[p] + 1, Q.push(k);
  }
}
int main() {
  cin >> n >> m >> s >> t;
  Adj.resize(n + 1);
  vector<bitset<1001> > mat(n + 1, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    Adj[a].push_back(b);
    Adj[b].push_back(a);
    mat[a][b] = mat[b][a] = true;
  }
  BFS(s, ds);
  BFS(t, dt);
  int R = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if ((ds[i] + dt[j] + 1 >= ds[t]) && (ds[j] + dt[i] + 1 >= ds[t]) &&
          (!mat[i][j]))
        R++;
  cout << R << endl;
}
