#include <bits/stdc++.h>
using namespace std;
int d[2][1005];
vector<int> g[1006];
int n;
void bfs(int flag, int s) {
  queue<int> q;
  q.push(s);
  vector<bool> used(n);
  vector<int> p(n);
  used[s] = true;
  p[s] = -1;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (size_t i = 0; i < g[v].size(); ++i) {
      int to = g[v][i];
      if (!used[to]) {
        used[to] = true;
        q.push(to);
        d[flag][to] = d[flag][v] + 1;
        p[to] = v;
      }
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int m, s, t;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < m; i++) {
    sort(g[i].begin(), g[i].end());
  }
  bfs(0, s);
  bfs(1, t);
  int dis = d[0][t];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (binary_search(g[i].begin(), g[i].end(), j)) continue;
      if (d[0][i] + d[1][j] + 1 >= dis && d[0][j] + d[1][i] + 1 >= dis) ans++;
    }
  }
  cout << ans;
  return 0;
}
