df8aad2509759e672de23ef51008ee14fc4762d495016c7245026d8766ffd9a8
// https://szkopul.edu.pl/problemset/problem/VM3OLYNfwgJDgCWFruNn7Z6c/site/?key=statement
/**
*
* TLE
*
* 90/100
*
*/
#include <bits/stdc++.h>
// #define GARY_DBG
#define GARY_LIB
constexpr int sizik = 200 * 1001;
#define ar std::array
// #define int int64_t
typedef std::vector<std::vector<int>> _kra;
void solve() {
int n;
std::cin >> n;
std::vector<std::pair<int, int>> v(n);
for (auto& [a, b] : v) {
std::cin >> a >> b;
}
if (n == 1) {
std::cout << "1\n";
std::cout << (v[0].first - 1) << " " << (v[0].second - 1) << '\n';
return;
}
std::vector<std::pair<int, int>> p(n);
for (int i = 0; i < n; i++) {
const auto& [a, b] = v[i];
auto& [c, d] = p[i];
c = a - b, d = a + b;
}
std::sort(p.begin(), p.end());
std::map<int, int> mx, my;
for (const auto& [x, y] : p) {
mx[x]++;
my[y]++;
}
std::vector<int> vx, vy;
for (const auto& [x, y] : p) {
vx.push_back(x);
vy.push_back(y);
}
std::sort(vx.begin(), vx.end(), [&mx](int a, int b) { return std::greater<int>()((int)mx[a], (int)mx[b]); });
std::sort(vy.begin(), vy.end(), [&my](int a, int b) { return std::greater<int>()((int)my[a], (int)my[b]); });
int ans = -1;
int ans_x = 0, ans_y = 0;
for (const auto& [x, y] : p) {
int local_ans = (int)mx[x] + (int)my[y] - 2;
if (local_ans > ans) {
ans = local_ans;
ans_x = x;
ans_y = y;
}
}
for (const auto& x : vx) {
for (const auto& y : vy) {
if ((x & 1) != (y & 1)) continue;
if ((int)mx[x] + (int)my[y] < ans) break;
// if (std::find(p.begin(), p.end(), std::make_pair(x, y)) == p.end()) {
if (!std::binary_search(p.begin(), p.end(), std::make_pair(x, y))) {
int local_ans = (int)mx[x] + (int)my[y];
if (local_ans > ans) {
ans = local_ans;
ans_x = x;
ans_y = y;
}
break;
}
}
}
for (const auto& x : vx) {
if ((int)mx[x] < ans) break;
if ((int)mx[x] > ans) {
ans = (int)mx[x];
ans_x = x;
ans_y = -2 * x;
}
}
for (const auto& y : vy) {
if ((int)my[y] < ans) break;
if ((int)my[y] > ans) {
ans = (int)my[y];
ans_y = y;
ans_x = -2 * y;
}
}
std::cout << ans << '\n';
int real_ans_x = (ans_x + ans_y) / 2;
int real_ans_y = (ans_y - ans_x) / 2;
std::cout << real_ans_x << " " << real_ans_y << '\n';
}
int32_t main() {
#ifndef GARY_DBG
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
#endif
int t = 1;
// std::cin >> t;
for (; t > 0; t--) {
solve();
}
return 0;
}