#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { ll n, sum1 = 0, min1 = 600, max1 = 0; cin >> n; vector> v(n, vector(2)); for (int i = 0; i < n; i++){ cin >> v[i][0] >> v[i][1]; max1 = (ll) max({v[i][0], v[i][1], max1}); } for (int i = 1; i <= max1; i++){ for (int j = 1; j <= max1; j++){ ll sum1 = 0; for (int k = 0; k < n; k++){ sum1 += (abs(v[k][0] - i) + abs(v[k][1] - j)); } min1 = min(min1, sum1); } } cout << min1 << endl; }