#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1001;
vector<int> g[MAXN];
int dist[MAXN][MAXN];
int vis[MAXN];
queue<int> q;
int n, m;
void bfs(int src) {
  q.push(src);
  while (!q.empty()) {
    int r = q.front();
    q.pop();
    vis[r] = 1;
    for (auto x : g[r]) {
      if (!vis[x]) {
        vis[x] = 1;
        dist[src][x] = min(dist[src][x], dist[src][r] + 1);
        q.push(x);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    vis[i] = 0;
  }
}
int main() {
  int src, dest, cnt = 0, u, v;
  cin >> n >> m >> src >> dest;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      dist[i][j] = MAXN;
    }
    dist[i][i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (dist[i][j] == 1 || dist[i][j] == 0) {
        continue;
      }
      if (1 + dist[src][i] + dist[j][dest] < dist[src][dest] ||
          1 + dist[src][j] + dist[i][dest] < dist[src][dest]) {
        continue;
      }
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
