#include <bits/stdc++.h>
using namespace std;
int n, m, s, t, ans;
int dis[1005][1005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> s >> t;
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= n; j++) {
      if (i == j) {
        continue;
      }
      dis[i][j] = 1e9;
    }
  }
  while (m--) {
    register int x, y;
    cin >> x >> y;
    dis[x][y] = dis[y][x] = 1;
  }
  for (register int k = 1; k <= n; k++) {
    for (register int i = 1; i <= n; i++) {
      for (register int j = 1; j <= n; j++) {
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
      }
    }
  }
  for (register int i = 1; i < n; i++) {
    for (register int j = i + 1; j <= n; j++) {
      if (dis[i][j] != 1 &&
          min(dis[i][s] + dis[t][j], dis[i][t] + dis[s][j]) + 1 >= dis[s][t]) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
