const INF: isize = 1000000000000; fn main() { let n: usize = { // 単一の整数を受け取り, nに束縛する let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim().parse().unwrap() }; let mut a = vec![0; n]; let mut b = vec![0; n]; for i in 0..n { let (c, d): (isize, isize) = { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap() ) }; a[i] = c; b[i] = d; } let mut ans = INF; for i in 0..301 { for j in 0..301 { let mut sum = 0; for k in 0..n { sum += (i - a[k]).abs() + (j - b[k]).abs(); } ans = ans.min(sum); } } println!("{}", ans); }