#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T x, T y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    T f = x % y;
    x = y;
    y = f;
  }
  return x;
}
void exgcd(long long a, long long b, long long &d, long long &x, long long &y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long inv(long long a, long long m) {
  long long x, y, d;
  exgcd(a, m, d, x, y);
  return d == 1 ? ((x % m) + m) % m : -1;
}
const int maxn = 1111;
int n, m, s, t;
vector<int> adj[maxn];
int hase[maxn][maxn];
int mins[maxn];
int mint[maxn];
int main(int argc, char *argv[]) {
  std::cin.sync_with_stdio(false);
  std::cin.tie(nullptr);
  cin >> n >> m >> s >> t;
  {
    memset(hase, 0, sizeof(hase));
    for (int i = 1; i <= n; i++) adj[i].clear(), mins[i] = mint[i] = n * 2 + 7;
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
      hase[a][b] = hase[b][a] = 1;
    }
    auto zz = [](int src, int d[]) {
      set<pair<int, int> > Q;
      d[src] = 0;
      Q.insert(make_pair(0, src));
      while (!Q.empty()) {
        int u = Q.begin()->second;
        Q.erase(Q.begin());
        for (int v : adj[u]) {
          if (d[v] > d[u] + 1) {
            Q.erase(make_pair(d[v], v));
            d[v] = d[u] + 1;
            Q.insert(make_pair(d[v], v));
          }
        }
      }
    };
    zz(s, mins);
    zz(t, mint);
    int dd = mins[t];
    int rr = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (!hase[i][j] &&
            min(mins[i] + mint[j], mins[j] + mint[i]) >= dd - 1) {
          rr++;
        }
      }
    }
    cout << rr << endl;
  }
  return 0;
}
