#include using namespace std; int main() { int n; cin >> n; vector> a(n); for (auto &i : a) cin >> i.first >> i.second; vector> cd = {{0, 0}, {0, 0}}; for (auto i : a) { cd[0].first += i.first; cd[0].second += i.second; cd[1].first += i.first; cd[1].second += i.second; } cd[0].first /= n; cd[0].second /= n; (cd[1].first += n - 1) /= n; (cd[1].second += n - 1) /= n; int s[2] = {0, 0}; for (auto i : a) { s[0] += abs(cd[0].first - i.first) + abs(cd[0].second - i.second); s[1] += abs(cd[1].first - i.first) + abs(cd[1].second - i.second); } cout << min(s[0], s[1]) << endl; }