#include <bits/stdc++.h>
using namespace std;
const long long INF = LLONG_MAX;
const long long base = 1e9;
const double PI = acos(-1);
const long long MOD = 1e9 + 7;
const long long N = 1e3 + 10;
vector<long long> g[N];
long long n, d[N][2];
bool vis[N], record[N][N];
void solve();
void bfs(long long s, long long o);
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
void solve() {
  long long m, s, t;
  cin >> n >> m >> s >> t;
  for (long long i = 0, x, y; i < m; ++i) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
    record[x][y] = record[y][x] = true;
  }
  bfs(s, 0);
  fill(vis, vis + n + 1, false);
  bfs(t, 1);
  long long dis = d[t][0] - 1, ans = 0;
  for (long long i = 1; i <= n; ++i) {
    for (long long j = i + 1; j <= n; ++j) {
      ans += (!record[i][j] and d[i][0] + d[j][1] >= dis and
              d[i][1] + d[j][0] >= dis);
    }
  }
  cout << ans << "\n";
  return;
}
void bfs(long long s, long long o) {
  queue<long long> q;
  q.push(s);
  vis[s] = true;
  while (!q.empty()) {
    long long v = q.front();
    q.pop();
    for (auto &x : g[v]) {
      if (!vis[x]) {
        vis[x] = true;
        q.push(x);
        d[x][o] = d[v][o] + 1;
      }
    }
  }
  return;
}
