#include <algorithm>
#include <iostream>
#include <climits>
#include <vector>

using ll = long long;
using strike_table = std::vector<std::pair<ll, std::pair<ll, ll>>>;

bool calcRRange(const ll size, const std::pair<ll, ll> &strike_range, std::pair<ll, ll> &result) {
	const ll strike_size = strike_range.second - strike_range.first;
	if(size < strike_size)
		return false;
	result = {strike_range.second, strike_range.second + size - strike_size}; 
	return true;
}

bool try_solve(const ll size, const strike_table &strikes) {
	// The position of the right end
	std::pair<ll, ll> cur_r_pos;
	auto it = strikes.cbegin();
	if(!calcRRange(size, it->second, cur_r_pos)) {
		return false;
	}
	ll t = it->first;
	for(++it; it != strikes.cend(); ++it) {
		const ll t_diff = it->first - t;
		t = it->first;
		std::pair<ll, ll> pot_r_pos;
		if(!calcRRange(size, it->second, pot_r_pos)) {
			return false;
		}
		std::pair<ll,ll> extended_cur_r_pos = {cur_r_pos.first - t_diff, cur_r_pos.second + t_diff};

		cur_r_pos.first = std::max(extended_cur_r_pos.first, pot_r_pos.first);
		cur_r_pos.second = std::min(extended_cur_r_pos.second, pot_r_pos.second);

		if(cur_r_pos.first > cur_r_pos.second) {
			return false;
		}
	}
	return true;
}

int main() {
	ll n;
	std::cin >> n;
	strike_table strikes;
	strikes.reserve(n);
	ll min_x = std::numeric_limits<ll>::max(), max_x = 0, largest_range = 0;
	std::vector<std::pair<ll, ll>> in(n);
	for (ll i = 0; i <n; i++) {
		ll t, x;
		std::cin >> t >> x;
		in[i] = {t, x};
	}
	sort(in.begin(), in.end());
	for (auto &event : in) {
		ll t, x;
		t = event.first;
		x = event.second;
		if(strikes.empty() || strikes.back().first != t)
			strikes.push_back({t,{std::numeric_limits<ll>::max(),0}});
		std::pair<ll,ll> &strike_range = strikes.back().second;
		strike_range.first = std::min(strike_range.first, x);
		strike_range.second = std::max(strike_range.second, x);
	}

	for(const auto &entry : strikes) {
		const std::pair<ll, ll> &range = entry.second;
		largest_range = std::max(largest_range, range.second - range.first);
		min_x = std::min(min_x, range.first);
		max_x = std::max(max_x, range.second);
	}

	ll low_size = largest_range - 1, high_size = max_x - min_x;
	while(high_size - low_size > 1) {
		ll mid_size = (low_size + high_size) / 2;
		if(try_solve(mid_size, strikes))
				high_size = mid_size;
		else
			low_size = mid_size;
	}
	std::cout << high_size << std::endl;
	return 0;
}
