#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e3 + 5;
const int INF = 0x3f3f3f3f;
const double eps = 1e-9;
short int mp[MAXN][MAXN];
int d[MAXN][2];
bool vis[MAXN];
int n, m, s, t, u, v;
void dijkstra(int s, int idx) {
  memset(vis, false, sizeof(vis));
  for (int i = 1; i <= n; i++) d[i][idx] = INF;
  d[s][idx] = 0;
  for (int i = 0; i < n; i++) {
    int x = -1, m = INF;
    for (int j = 1; j <= n; j++)
      if (!vis[j] && d[j][idx] < m) m = d[x = j][idx];
    if (x != -1) {
      vis[x] = true;
      for (int j = 1; j <= n; j++) {
        if (mp[x][j] == 1 && d[j][idx] > d[x][idx] + 1) {
          d[j][idx] = d[x][idx] + 1;
        }
      }
    }
  }
}
int main() {
  scanf("%d %d %d %d", &n, &m, &s, &t);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    mp[u][v] = mp[v][u] = 1;
  }
  dijkstra(s, 0);
  dijkstra(t, 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (mp[i][j] == 0 && d[i][0] + d[j][1] + 1 >= d[t][0] &&
          d[i][1] + d[j][0] + 1 >= d[t][0])
        ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
