#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 10, M = 2000 + 10;
int n, m, s, t;
int h[N], ecnt, nxt[M], v[M];
bool mp[N][N];
int dis[2][N], ans;
void _add(int x, int y) {
  nxt[++ecnt] = h[x];
  v[ecnt] = y;
  h[x] = ecnt;
  mp[x][y] = 1;
}
queue<int> que;
void dijkstra(int s, int *dis) {
  for (int i = 1; i <= n; ++i) dis[i] = -1;
  que.push(s);
  dis[s] = 0;
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    for (int i = h[u]; i; i = nxt[i])
      if (dis[v[i]] == -1) {
        dis[v[i]] = dis[u] + 1;
        que.push(v[i]);
      }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> s >> t;
  ecnt = 1;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    _add(x, y);
    _add(y, x);
  }
  dijkstra(s, dis[0]);
  dijkstra(t, dis[1]);
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (!mp[i][j]) {
        ans += min(dis[0][i] + dis[1][j] + 1, dis[1][i] + dis[0][j] + 1) >=
               dis[0][t];
      }
  cout << ans << endl;
  return 0;
}
