//Normal-2 #define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; void p(auto a){ cout << a; } void ps(auto a){ cout << a << " "; } void ps(){ cout << " "; } void pl(auto a){ cout << a << endl; } void pl(){ cout << endl; } void fix15(){ cout << fixed << setprecision(15); } void YES(){ pl("YES"); } void NO(){ pl("NO"); } void Yes(){ pl("Yes"); } void No(){ pl("No"); } void yes(){ pl("yes"); } void no(){ pl("no"); } //Normal-2 int main(){ int N; cin >> N; vector X(N), Y(N); int xmin = 300, xmax = 1, ymin = 300, ymax = 1; for(int i = 0; i < N; i++){ cin >> X[i] >> Y[i]; xmin = min(xmin, X[i]); xmax = max(xmax, X[i]); ymin = min(ymin, Y[i]); ymax = max(ymax, Y[i]); } int near = 1e9; for(int a = xmin; a <= xmax; a++){ for(int b = ymin; b <= ymax; b++){ int diff = 0; for(int n = 0; n < N; n++){ diff += abs(X[n]-a); diff += abs(Y[n]-b); } near = min(near, diff); } } pl(near); }