#include <bits/stdc++.h>
using namespace std;
vector<int> v[1005];
int vis[1005], dis1[1005], dis2[1005];
void BFS1(int a) {
  vis[a] = 1;
  queue<int> q;
  q.push(a);
  while (!q.empty()) {
    int top = q.front();
    q.pop();
    for (int k = 0; k < v[top].size(); k++) {
      int l = v[top][k];
      if (vis[l] == 0) {
        vis[l] = 1;
        dis1[l] = dis1[top] + 1;
        q.push(l);
      }
    }
  }
}
void BFS2(int a) {
  vis[a] = 1;
  queue<int> q;
  q.push(a);
  while (!q.empty()) {
    int top = q.front();
    q.pop();
    for (int k = 0; k < v[top].size(); k++) {
      int l = v[top][k];
      if (vis[l] == 0) {
        vis[l] = 1;
        dis2[l] = dis2[top] + 1;
        q.push(l);
      }
    }
  }
}
int main() {
  map<pair<int, int>, int> mp;
  int n, m, i, j, a, b, ans = 0, x, s, t;
  scanf("%d %d %d %d", &n, &m, &s, &t);
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
    mp[make_pair(a, b)] = 1;
    mp[make_pair(b, a)] = 1;
  }
  BFS1(s);
  for (i = 0; i < 1005; i++) {
    vis[i] = 0;
  }
  BFS2(t);
  x = dis1[t];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (mp[make_pair(i, j)] == 1 || i >= j) {
        continue;
      }
      int p = min(dis1[i] + dis2[j] + 1, dis1[j] + dis2[i] + 1);
      if (p >= x) {
        ans++;
      }
    }
  }
  printf("%d", ans);
}
