#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
const long long dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
long long n;
long long dist[1009];
vector<long long> graph[1009];
void BFS(long long source) {
  for (long long i = 0; i <= n + 2; i++) {
    dist[i] = 1e9;
  }
  queue<long long> q;
  q.push(source);
  dist[source] = 0;
  long long cnt = -1;
  while (q.size()) {
    cnt++;
    long long sz = q.size();
    for (long long i = 0; i < sz; i++) {
      auto x = q.front();
      q.pop();
      dist[x] = min(cnt, dist[x]);
      for (auto nei : graph[x]) {
        if (dist[nei] > 100000) {
          q.push(nei);
        }
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long test = 1;
  while (test--) {
    long long m, s, t;
    cin >> n >> m >> s >> t;
    bool st[n + 1][n + 1];
    memset(st, false, sizeof st);
    for (long long i = 0; i < m; i++) {
      long long x, y;
      cin >> x >> y;
      graph[x].push_back(y);
      graph[y].push_back(x);
      st[x][y] = st[y][x] = 1;
    }
    vector<long long> shortestDistance[n + 2];
    for (long long i = 1; i <= n; i++) {
      BFS(i);
      for (long long j = 0; j <= n; j++) shortestDistance[i].push_back(dist[j]);
    }
    long long ans = 0;
    for (long long i = 1; i <= n; i++) {
      for (long long j = i + 1; j <= n; j++) {
        if (!st[i][j]) {
          if (1 + shortestDistance[s][i] + shortestDistance[j][t] >=
                  shortestDistance[s][t] and
              1 + shortestDistance[t][i] + shortestDistance[j][s] >=
                  shortestDistance[s][t])
            ans++;
        }
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
