#include <bits/stdc++.h>
using namespace std;
int n, m, s, t, flag[1005][1005], has, k, nil[1005], tan1[1005], tan2[1005],
    nil2[1005];
vector<int> arr[1005];
queue<pair<int, int> > q, p;
int main() {
  cin >> n >> m >> s >> t;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    arr[a].push_back(b);
    arr[b].push_back(a);
    flag[a][b] = -1;
    flag[b][a] = -1;
  }
  q.push({s, 0});
  tan1[s] = -1;
  nil[s] = 0;
  while (!q.empty()) {
    int x = q.front().first, y = q.front().second;
    q.pop();
    for (int i = 0; i < arr[x].size(); i++) {
      if (tan1[arr[x][i]] == 0) {
        q.push({arr[x][i], y + 1});
        tan1[arr[x][i]] = -1;
        nil[arr[x][i]] = y + 1;
      }
    }
  }
  p.push({t, 0});
  tan2[t] = -1;
  nil2[t] = 0;
  while (!p.empty()) {
    int x = p.front().first, y = p.front().second;
    p.pop();
    for (int i = 0; i < arr[x].size(); i++) {
      if (tan2[arr[x][i]] == 0) {
        p.push({arr[x][i], y + 1});
        tan2[arr[x][i]] = -1;
        nil2[arr[x][i]] = y + 1;
      }
    }
  }
  int d = nil[t];
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (nil[i] + nil2[j] + 1 >= d && nil[j] + nil2[i] + 1 >= d &&
          flag[i][j] == 0 && flag[j][i] == 0)
        has++;
    }
  }
  cout << has << endl;
}
