#include <bits/stdc++.h>
using namespace std;
int n, m, S, T, p[1010][1010], dis[2][1010], vis[2][1010];
set<int> g[1010];
void Work(int t, int v) {
  queue<int> Q;
  Q.push(v);
  vis[t][v] = 1;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    for (auto i : g[u]) {
      if (vis[t][i]) continue;
      vis[t][i] = 1;
      dis[t][i] = dis[t][u] + 1;
      Q.push(i);
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &m, &S, &T);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    p[x][y] = p[y][x] = 1;
    g[x].insert(y);
    g[y].insert(x);
  }
  Work(0, S);
  Work(1, T);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!p[i][j]) {
        if (dis[0][i] + dis[1][j] + 1 >= dis[0][T] &&
            dis[1][i] + dis[0][j] + 1 >= dis[0][T])
          ans++;
      }
  printf("%d\n", ans);
  return 0;
}
