#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using pii = pair<int, int>;
vector<int> sp_bfs(const vector<vector<int>> &graph, int s) {
  int n = graph.size();
  vector<int> dist(n, numeric_limits<int>::max() / 2);
  dist[s] = 0;
  deque<int> q;
  q.push_back(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop_front();
    for (int v : graph[u]) {
      if (dist[v] > dist[u] + 1) {
        dist[v] = dist[u] + 1;
        q.push_back(v);
      }
    }
  }
  return dist;
}
template <typename T>
void print_vec(const vector<T> vec) {
  for (const auto &el : vec) cout << el << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cout.precision(17);
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--;
  t--;
  vector<vector<int>> graph(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  vector<vector<bool>> to_check(n, vector<bool>(n, true));
  for (int u = 0; u < n; u++) {
    for (int v : graph[u]) {
      to_check[u][v] = false;
    }
  }
  auto dist_s = sp_bfs(graph, s);
  auto dist_t = sp_bfs(graph, t);
  int res = 0;
  int d = dist_s[t];
  for (int u = 0; u < n; u++) {
    for (int v = 0; v < u; v++) {
      if (to_check[u][v]) {
        int new_d = min(dist_s[u] + dist_t[v], dist_t[u] + dist_s[v]) + 1;
        if (d <= new_d) res++;
      }
    }
  }
  cout << res << endl;
  return 0;
}
