use std::io; use std::io::prelude::*; fn main() { let stdin = io::read_to_string(io::stdin()).unwrap(); let mut stdin = stdin.split_whitespace(); let stdout = io::stdout(); let mut stdout = io::BufWriter::new(stdout.lock()); let _: isize = stdin.next().unwrap().parse::().unwrap(); let _: isize = stdin.next().unwrap().parse::().unwrap(); let sy: isize = stdin.next().unwrap().parse::().unwrap(); let sx: isize = stdin.next().unwrap().parse::().unwrap(); let gy: isize = stdin.next().unwrap().parse::().unwrap(); let gx: isize = stdin.next().unwrap().parse::().unwrap(); writeln!(stdout, "{}", (sx - gx).abs() + (sy - gy).abs()).unwrap_or(()); }