#include <bits/stdc++.h>
using namespace std;
vector<int> v[1001], vis(1001);
int dis[1001][1001];
void bfs(int i) {
  for (int i = 1; i < 1001; i++) vis[i] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      p;
  p.push({0, i});
  vis[i] = 1;
  while (p.size()) {
    pair<int, int> q = p.top();
    p.pop();
    for (auto x : v[q.second]) {
      if (!vis[x]) {
        vis[x] = 1;
        dis[i][x] = 1 + dis[i][q.second];
        p.push({dis[i][x], x});
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  map<pair<int, int>, int> mp;
  for (long long int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    mp[{x, y}] = 1;
    mp[{y, x}] = 1;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    bfs(i);
  }
  int ans = 0;
  int val = dis[s][t];
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!mp[{i, j}]) {
        int newdist = min(dis[s][i] + 1 + dis[t][j], 1 + dis[s][j] + dis[t][i]);
        if (newdist >= val) ans++;
      }
    }
  }
  cout << ans;
}
