/*
TASK: dist
LANG: C++
*/
#include <iostream>
#include <cmath>

using namespace std;

#define _MAX 5000

class point
{
public:
	int x;
	int y;
};

class polygon
{
public:
	int n;
	point a[_MAX];
};

int n;
long long int r;
point a;
polygon p;

long long int dist(int x1, int y1, int x2, int y2)
{
	return (x1 - x2) * (x1 - x2) + (y1 - y2)*(y1 - y2);
}

void init()
{
	cin >> n;
	cin >> a.x;
	cin >> a.y;
	for (int i = 0; i < n; i++)
	{
		cin >> p.a[i].x;
		cin >> p.a[i].y;
	}
}

void solve()
{
	r = dist(a.x, a.y, p.a[0].x, p.a[0].y);
	long long int current;
	for (int i = 1; i < n; i++)
		if ((current = dist(a.x, a.y, p.a[i].x, p.a[i].y)) < r)
			r = current;
	cout << trunc(sqrt(r)) << endl;
}

int main()
{
	init();
	solve();
	
    return 0;
}
