#include <bits/stdc++.h>
using namespace std;
int n, m, s, t;
vector<int> mm[1500];
bool ma[1500][1500];
void bfs(int x, int dis[]) {
  queue<int> q;
  bool vis[1500];
  memset(vis, 0, sizeof(vis));
  q.push(x);
  vis[x] = 1;
  dis[x] = 0;
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    vis[now] = 1;
    for (int i = 0; i < mm[now].size(); i++) {
      int tmp = mm[now][i];
      if (!vis[tmp]) {
        q.push(tmp);
      }
      dis[tmp] = min(dis[tmp], dis[now] + 1);
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &s, &t);
  memset(ma, 0, sizeof(ma));
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    mm[a].push_back(b);
    mm[b].push_back(a);
    ma[a][b] = ma[b][a] = 1;
  }
  int sd[1500], td[1500];
  memset(sd, 0x3f3f3f3f, sizeof(sd));
  memset(td, 0x3f3f3f3f, sizeof(td));
  bfs(s, sd);
  bfs(t, td);
  int ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (ma[i][j]) continue;
      if (sd[i] + td[j] + 1 < sd[t] || sd[j] + td[i] + 1 < td[s]) continue;
      ans++;
    }
  }
  printf("%d\n", ans);
}
