#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, x, y; cin >> n; vector> a(n); for(int i = 0; i < n; i++){ cin >> x >> y; a[i] = {x, y}; } int ans = 1 << 30; for(int cx = 0; cx <= 300; cx++){ for(int cy = 0; cy <= 300; cy++){ int s = 0; for(int i = 0; i < n; i++){ tie(x, y) = a[i]; s += abs(x - cx) + abs(y - cy); } ans = min(ans, s); } } cout << ans << '\n'; }