#include using namespace std; using lint = long long; int main() { int n; cin >> n; vector x(n), y(n); for (int i= 0; i < n; i++) cin >> x[i] >> y[i]; int ans = (1<<30); for (int i = 0; i <= 300; i++) { for (int j = 0; j <= 300; j++) { int sum = 0; for (int k = 0; k < n; k++) { sum += abs(i-x[k])+abs(j-y[k]); } ans = min(ans, sum); } } cout << ans << endl; }