#include <bits/stdc++.h>
using graph = std::vector<std::set<int>>;
const int unvisited = -1;
std::vector<int> bfs(graph& junction, int s) {
  std::queue<int> bag;
  bag.push(s);
  std::vector<int> distance(junction.size(), unvisited);
  distance[s] = 0;
  while (!bag.empty()) {
    s = bag.front();
    bag.pop();
    for (int neighbour : junction[s]) {
      if (distance[neighbour] == unvisited) {
        distance[neighbour] = distance[s] + 1;
        bag.push(neighbour);
      }
    }
  }
  return std::move(distance);
}
int main(int argc, char const* argv[]) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int n, m, s, t, u, v;
  std::cin >> n >> m >> s >> t;
  graph junction(n);
  for (int k = 1; k <= m; k++) {
    std::cin >> u >> v;
    junction[--u].insert(--v);
    junction[v].insert(u);
  }
  std::vector<int> froms(bfs(junction, --s));
  std::vector<int> fromt(bfs(junction, --t));
  int answer = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int newdistance = std::min(froms[i] + fromt[j], froms[j] + fromt[i]) + 1;
      if (!junction[i].count(j) && newdistance >= froms[t]) {
        answer++;
      }
    }
  }
  std::cout << answer << std::endl;
  return 0;
}
