#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using graph = vector<vector<int>>;

const int INF = 1e9;

vector<int> bfs(int s, const graph& G) {
	vector<int> d(G.size(), INF);
	queue<int> q;
	q.push(s);
	d[s] = 0;
	while (!q.empty()) {
		int v = q.front(); q.pop();
		for (auto to : G[v]) if (d[to] == INF) {
			q.push(to);
			d[to] = d[v] + 1;
		}
	}
	return d;
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int N, M, s, t;
	cin >> N >> M >> s >> t; --s, --t;
	graph G(N);
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v; --u, --v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	auto d1 = bfs(s, G);
	auto d2 = bfs(t, G);
	int dist = d1[t];
	sort(d1.begin(), d1.end());
	sort(d2.begin(), d2.end());
	ll res = 0;
	for (int i = 0; i < N; i++) {
		if (d1[i] <= dist - 2) {
			res += upper_bound(d2.begin(), d2.end(), dist - 2 - d1[i])
				 - lower_bound(d2.begin(), d2.end(), dist - 2 - d1[i]);
		}
	}
	cout << res << endl;
	return 0;
}

