pub fn count_borders_in_range(grid: &Grid, start: usize, end: usize) -> usize