#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30);
const int MAXN = 100005;
vector<vector<pair<int, int> > > g;
vector<int> dist1, dist2;
bool mat[1003][1003];
void dijkstra1(int b) {
  priority_queue<pair<int, int> > q;
  pair<int, int> s, v;
  q.push(make_pair(0, b));
  dist1[b] = 0;
  while (!q.empty()) {
    s = q.top();
    q.pop();
    for (int i = 0; i < (int)g[s.second].size(); ++i) {
      v = g[s.second][i];
      if ((v.first * -1) + (s.first * -1) < dist1[v.second]) {
        dist1[v.second] = (v.first * -1) + abs(s.first * -1);
        q.push(make_pair(dist1[v.second] * -1, v.second));
      }
    }
  }
}
void dijkstra2(int b) {
  priority_queue<pair<int, int> > q;
  pair<int, int> s, v;
  q.push(make_pair(0, b));
  dist2[b] = 0;
  while (!q.empty()) {
    s = q.top();
    q.pop();
    for (int i = 0; i < (int)g[s.second].size(); ++i) {
      v = g[s.second][i];
      if ((v.first * -1) + (s.first * -1) < dist2[v.second]) {
        dist2[v.second] = (v.first * -1) + abs(s.first * -1);
        q.push(make_pair(dist2[v.second] * -1, v.second));
      }
    }
  }
}
int main() {
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  g.assign(n + 5, vector<pair<int, int> >());
  dist1.assign(n + 5, inf);
  dist2.assign(n + 5, inf);
  while (m--) {
    int x, y;
    cin >> x >> y;
    mat[x][y] = true;
    mat[y][x] = true;
    g[x].push_back(make_pair(-1, y));
    g[y].push_back(make_pair(-1, x));
  }
  dijkstra1(s);
  dijkstra2(t);
  int dm = dist1[t], ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (!mat[i][j]) {
        if (min(dist1[i] + dist2[j], dist1[j] + dist2[i]) + 1 >= dm) {
          ans++;
        }
      }
    }
  }
  cout << ans << '\n';
}
