#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1100;
int dis[2][MAXN];
bool e[MAXN][MAXN];
vector<int> g[MAXN];
void bfs(int v, int ind) {
  memset(dis[ind], 31, sizeof dis[ind]);
  queue<int> q;
  q.push(v);
  dis[ind][v] = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int w : g[u])
      if (dis[ind][w] > dis[ind][u] + 1) {
        dis[ind][w] = dis[ind][u] + 1;
        q.push(w);
      }
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    v--;
    u--;
    e[v][u] = e[u][v] = true;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  bfs(s, 0);
  bfs(t, 1);
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (e[i][j]) continue;
      if (dis[0][i] + dis[1][j] + 1 >= dis[0][t] and
          dis[0][j] + dis[1][i] + 1 >= dis[0][t])
        ans++;
    }
  cout << ans << endl;
  return 0;
}
