#include using namespace std; const int N = 10010; int x[N], y[N]; int n, res; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> x[i] >> y[i]; sort(y, y + n); sort(x, x + n); for (int i = 0; i < n; i++) res += abs(y[i] - y[n / 2]); // 对与x轴的一条平等线的最短距离和 for (int i = 0; i < n; i++) x[i] -= i; sort(x, x + n); for (int i = 0; i < n; i++) res += abs(x[i] - x[n / 2]); // 输出 cout << res << endl; return 0; }