#include <bits/stdc++.h>
std::vector<std::vector<int> > g(1010);
void bfs(int start, int sDist[1010]) {
  std::queue<int> q, qcounter;
  q.push(start);
  qcounter.push(1);
  while (q.empty() == false) {
    int top = q.front(), counter = qcounter.front();
    q.pop();
    qcounter.pop();
    if (sDist[top] != 0)
      continue;
    else
      sDist[top] = counter;
    for (int i = 0; i < g[top].size(); ++i) {
      int next = g[top][i];
      if (sDist[next] == 0) {
        q.push(next);
        qcounter.push(counter + 1);
      }
    }
  }
}
int main() {
  int n, m;
  std::cin >> n >> m;
  int start, e;
  std::cin >> start >> e;
  --start;
  --e;
  bool did[1010][1010] = {0};
  for (int i = 0; i < m; ++i) {
    int x, y;
    std::cin >> x >> y;
    --x;
    --y;
    g[x].push_back(y);
    g[y].push_back(x);
    did[x][y] = 1;
    did[y][x] = 1;
  }
  int sDist[1010] = {0}, eDist[1010] = {0};
  bfs(start, sDist);
  bfs(e, eDist);
  for (int i = 0; i < n; ++i) {
    sDist[i] -= 1;
    eDist[i] -= 1;
  }
  int min = sDist[e], ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (did[i][j] || did[j][i]) continue;
      if (sDist[i] + eDist[j] + 1 < min || sDist[j] + eDist[i] + 1 < min)
        continue;
      else {
        ++ans;
      }
    }
  }
  std::cout << ans;
}
