#include <bits/stdc++.h>
using namespace std;
int n, m, s, t, d[200005], v[200005], dd[200005], ma[1005][1005], ok = 1, y,
                                                                  ans;
int main() {
  scanf("%d%d%d%d", &n, &m, &s, &t);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    ma[x][y] = ma[y][x] = 1;
  }
  for (int i = 1; i <= n; i++) d[i] = 1000000000, v[i] = 0;
  d[s] = 0;
  for (int i = 1; i <= n; i++) {
    int minv = 1000000000, u;
    for (int j = 1; j <= n; j++)
      if (!v[j] && d[j] < minv) {
        minv = d[j];
        u = j;
      }
    v[u] = 1;
    for (int k = 1; k <= n; k++)
      if (!v[k] && ma[u][k] && d[u] + ma[u][k] < d[k]) d[k] = d[u] + ma[u][k];
  }
  for (int i = 1; i <= n; i++) dd[i] = 1000000000, v[i] = 0;
  dd[t] = 0;
  for (int i = 1; i <= n; i++) {
    int minv = 1000000000, u;
    for (int j = 1; j <= n; j++)
      if (!v[j] && dd[j] < minv) {
        minv = dd[j];
        u = j;
      }
    v[u] = 1;
    for (int k = 1; k <= n; k++)
      if (!v[k] && ma[u][k] && dd[u] + ma[u][k] < dd[k])
        dd[k] = dd[u] + ma[u][k];
  }
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!ma[i][j]) {
        if (d[i] + dd[j] + 1 >= d[t] && d[j] + dd[i] + 1 >= d[t]) {
          ans++;
        }
      }
  printf("%d", ans);
}
