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 xsum = 0; let mut ysum = 0; let mut a = vec![0; n]; let mut b = vec![0; n]; for i in 0..n { let (c, d): (usize, usize) = { 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; xsum += a[i]; ysum += b[i]; } let x = xsum / n; let y = ysum / n; let mut ans = [0, 0]; for i in 0..n { ans[0] += (x as isize - a[i] as isize).abs(); ans[0] += (y as isize - b[i] as isize).abs(); ans[1] += (x as isize - a[i] as isize + 1).abs(); ans[1] += (x as isize - b[i] as isize + 1).abs(); } println!("{}", ans[0].min(ans[1])); }