#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1005;
int adj[N][N], dist[N][N], vis[N][N];
vector<int> G[N];
int que[2 * N];
void bfs(int u) {
  int st = 0, ed = 0;
  que[0] = u;
  vis[u][u] = 1;
  while (st <= ed) {
    int ver = que[st];
    st++;
    for (int i = 0; i < (int)(G[ver].size()); i++) {
      int v = G[ver][i];
      if (!vis[u][v]) {
        vis[u][v] = 1;
        que[++ed] = v;
        dist[u][v] = dist[u][ver] + 1;
      }
    }
  }
}
int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
    adj[u][v] = adj[v][u] = 1;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dist[i][j] = 20000000;
  for (int i = 1; i <= n; i++) dist[i][i] = 0;
  for (int i = 1; i <= n; i++) bfs(i);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (adj[i][j] == 0 && dist[s][i] + dist[j][t] + 1 >= dist[s][t] &&
          dist[s][j] + dist[i][t] + 1 >= dist[s][t])
        ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}
