#include <bits/stdc++.h>
using namespace std;
vector<int> V[1005];
int dis[1005], rdis[1005], G[1005][1005];
void spfa(int s, int e) {
  queue<int> Q;
  memset(dis, 0x3f, sizeof(dis));
  memset(rdis, 0x3f, sizeof(rdis));
  Q.push(s);
  dis[s] = 0;
  while (!Q.empty()) {
    int f = Q.front();
    for (int i = (0); i < ((int)(V[f]).size()); i++) {
      int nex = V[f][i];
      if (dis[nex] > dis[f] + 1) {
        dis[nex] = dis[f] + 1;
        Q.push(nex);
      }
    }
    Q.pop();
  }
  Q.push(e);
  rdis[e] = 0;
  while (!Q.empty()) {
    int f = Q.front();
    for (int i = (0); i < ((int)(V[f]).size()); i++) {
      int nex = V[f][i];
      if (rdis[nex] > rdis[f] + 1) {
        rdis[nex] = rdis[f] + 1;
        Q.push(nex);
      }
    }
    Q.pop();
  }
}
int main() {
  int n, m, s, e;
  scanf("%d%d%d%d", &n, &m, &s, &e);
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    V[a].push_back(b);
    V[b].push_back(a);
    G[a][b] = G[b][a] = 1;
  }
  int ans = 0;
  spfa(s, e);
  for (int i = (1); i < (n + 1); i++)
    for (int j = (i + 1); j < (n + 1); j++)
      if (dis[i] + 1 + rdis[j] >= dis[e] && dis[j] + 1 + rdis[i] >= dis[e] &&
          !G[i][j])
        ans++;
  printf("%d\n", ans);
  return 0;
}
