#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const long long mod = 1e9 + 7;
const int INF = 1e9;
const double eps = 1e-6;
int n, m;
int vis[maxn];
vector<int> vec[maxn];
void spfa(int ss, int dis[]) {
  for (int i = 1; i <= n; i++) dis[i] = INF;
  memset((vis), (0), sizeof(vis));
  queue<int> q;
  q.push(ss);
  vis[ss] = 1;
  dis[ss] = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();
    vis[u] = 0;
    for (int i = 0; i < vec[u].size(); i++) {
      int v = vec[u][i];
      if (dis[v] > dis[u] + 1) {
        dis[v] = dis[u] + 1;
        if (vis[v] == 0) {
          vis[v] = 1;
          q.push(v);
        }
      }
    }
  }
}
int main() {
  int dis1[maxn], dis2[maxn];
  int s, t;
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  spfa(s, dis1);
  spfa(t, dis2);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      if ((dis1[i] + dis2[j] + 1 >= dis1[t]) &&
          (dis1[j] + dis2[i] + 1 >= dis1[t]))
        ans++;
    }
  printf("%d\n", ans - m);
}
