#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int ds[N], de[N];
vector<int> vec[N];
int vis[N];
int n, m, s, t;
bool g[N][N];
queue<int> q;
int main() {
  scanf("%d %d %d %d", &n, &m, &s, &t);
  int a, b;
  while (m--) {
    scanf("%d%d", &a, &b);
    vec[a].push_back(b);
    vec[b].push_back(a);
    g[a][b] = true;
    g[b][a] = true;
  }
  memset(vis, 0, sizeof(vis));
  ds[s] = 0;
  q.push(s);
  vis[s] = 1;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    for (int i = 0; i < vec[t].size(); i++) {
      int v = vec[t][i];
      if (!vis[v]) {
        q.push(v);
        ds[v] = ds[t] + 1;
        vis[v] = 1;
      }
    }
  }
  memset(vis, 0, sizeof(vis));
  de[t] = 0;
  q.push(t);
  vis[t] = 1;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    for (int i = 0; i < vec[t].size(); i++) {
      int v = vec[t][i];
      if (!vis[v]) {
        q.push(v);
        de[v] = de[t] + 1;
        vis[v] = 1;
      }
    }
  }
  int ans = 0;
  int l = ds[t];
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (ds[i] + de[j] + 1 >= l && ds[j] + de[i] + 1 >= l && !g[i][j]) {
        ans++;
      }
    }
  }
  printf("%d", ans);
}
