let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w 0 in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  let idx = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if used.(i).(j) = 0 then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if used.(y).(x) = 0 then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- !idx;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      incr idx;
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- !idx;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 4 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if used.(y').(x') = !idx
			       then incr s;
			       if used.(y').(x') = !idx && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 4 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w 0 in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  let idx = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if used.(i).(j) = 0 then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if used.(y).(x) = 0 then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- !idx;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      incr idx;
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- !idx;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 4 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h &&
			     (x' - x) * (x' - x) + (y' - y) * (y' - y) <= d * d
			   then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if used.(y').(x') = !idx
			       then incr s;
			       if used.(y').(x') = !idx && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && float_of_int !s *. 6.5 < float_of_int !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w 0 in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  let idx = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if used.(i).(j) = 0 then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if used.(y).(x) = 0 then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- !idx;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      incr idx;
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- !idx;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 4 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if used.(y').(x') = !idx
			       then incr s;
			       if used.(y').(x') = !idx && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && float_of_int !s *. 3.5 < float_of_int !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w false in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if not used.(i).(j) then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if not used.(y).(x) then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- true;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- true;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)
	      in
	      let ps = ref [] in
	      let d = 5 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if a.(y').(x') <> 0
			       then incr s;
			       if a.(y').(x') <> 0 && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 3 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w 0 in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  let idx = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if used.(i).(j) = 0 then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if used.(y).(x) = 0 then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- !idx;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      incr idx;
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- !idx;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 5 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if used.(y').(x') = !idx
			       then incr s;
			       if used.(y').(x') = !idx && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 4 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w 0 in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  let idx = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if used.(i).(j) = 0 then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if used.(y).(x) = 0 then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- !idx;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      incr idx;
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- !idx;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 3 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if used.(y').(x') = !idx
			       then incr s;
			       if used.(y').(x') = !idx && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 4 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w false in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if not used.(i).(j) then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if not used.(y).(x) then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- true;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- true;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 5 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if a.(y').(x') <> 0
			       then incr s;
			       if a.(y').(x') <> 0 && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 4 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w false in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if not used.(i).(j) then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if not used.(y).(x) then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- true;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- true;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 5 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if a.(y').(x') <> 0
			       then incr s;
			       if a.(y').(x') <> 0 && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 3 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w false in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if not used.(i).(j) then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if not used.(y).(x) then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- true;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- true;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 6 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if a.(y').(x') <> 0
			       then incr s;
			       if a.(y').(x') <> 0 && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 4 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let sqr x = x *. x in
  let h = getnum () in
  let w = getnum () in
  let a = Array.make_matrix h w 0 in
  let () =
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	a.(i).(j) <- getnum ()
      done
    done
  in
  let cand = Array.make_matrix h w false in
  let res = ref 0 in
  let rays = ref [] in
  let used = Array.make_matrix h w 0 in
  let stack = Array.make (h * w) (0, 0) in
  let pos = ref 0 in
  let idx = ref 0 in
  (*let a' = Array.make_matrix n n 0 in
    for i = 0 to n - 1 do
      for j = 0 to n - 1 do
	let b = ref 0 in
	  for i' = -f to f do
	    for j' = -f to f do
	      let x = j + j'
	      and y = i + i' in
		if x >= 0 && y >= 0 && x < n && y < n
		then b := !b + a.(y).(x)
	    done
	  done;
	  if float_of_int !b > float_of_int ((2 * f + 1) * (2 * f + 1)) *. 0.4
	  then a'.(i).(j) <- 1
      done
    done;
    for i = 0 to n - 1 do
      a.(i) <- a'.(i)
    done;*)
    for i = 0 to h - 1 do
      for j = 0 to w - 1 do
	if used.(i).(j) = 0 then (
	  if a.(i).(j) <> 0 then (
	    let d = [| (1, 0); (0, 1); (-1, 0); (0, -1) |] in
	    let border = ref [] in
	    let mx = ref 0 in
	    let my = ref 0 in
	    let cnt = ref 0 in
	    let rec dfs () =
	      if !pos > 0 then (
		decr pos;
		let (x, y) = stack.(!pos) in
		  mx := !mx + x;
		  my := !my + y;
		  incr cnt;
		  for i = 0 to 3 do
		    let (dx, dy) = d.(i) in
		    let x = x + dx
		    and y = y + dy in
		      if x >= 0 && y >= 0 && x < w && y < h &&
			a.(y).(x) > 0
		      then (
			if used.(y).(x) = 0 then (
			  stack.(!pos) <- (x, y);
			  incr pos;
			  used.(y).(x) <- !idx;
			)
		      ) else (
			border := (x, y) :: !border
		      )
		  done;
		  dfs ()
	      )
	    in
	      incr idx;
	      pos := 0;
	      stack.(!pos) <- (j, i);
	      incr pos;
	      used.(i).(j) <- !idx;
	      dfs ();
	      let border = Array.of_list !border in
	      let l = Array.length border in
	      let (mx, my) =
		(*let mx = ref 0 in
		let my = ref 0 in
		  for i = 0 to l - 1 do
		    let (x, y) = border.(i) in
		      mx := !mx + x;
		      my := !my + y;
		  done;
		  (float_of_int !mx /. float_of_int l,
		   float_of_int !my /. float_of_int l)*)
		(float_of_int !mx /. float_of_int !cnt,
		 float_of_int !my /. float_of_int !cnt)
	      in
	      let ps = ref [] in
	      let d = 6 in
	      let () =
		Array.iter
		  (fun (x, y) ->
		     let b = ref true in
		     let dist =
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		     in
		     let s = ref 0 in
		     let t = ref 0 in
		       for y' = y - d to y + d do
			 for x' = x - d to x + d do
			   incr t;
			   if x' >= 0 && y' >= 0 && x' < w && y' < h then (
			     let dist' =
			       let x = float_of_int x'
			       and y = float_of_int y' in
				 sqrt (sqr (x -. mx) +. sqr (y -. my))
			     in
			       if cand.(y').(x')
			       then b := false;
			       if used.(y').(x') = !idx
			       then incr s;
			       if used.(y').(x') = !idx && dist' > dist
			       then b := false;
			   )
			 done
		       done;
		       if !b && !s * 4 < !t then (
			 cand.(y).(x) <- true;
			 ps := (x, y) :: !ps;
			 (*Printf.printf "asd %d %d  %d %d\n" x y !s !t;*)
		       )
		  ) border
	      in
		rays := (List.length !ps) :: !rays;
		incr res;
		(*let d =
		  Array.map
		    (fun (x, y) ->
		       let x = float_of_int x
		       and y = float_of_int y in
			 sqrt (sqr (x -. mx) +. sqr (y -. my))
		    ) border
		in
		let r =
		  let r = ref 0.0 in
		    for i = 0 to l - 1 do
		      r := !r +. d.(i)
		    done;
		    !r /. float_of_int l
		in
		let sr =
		  let sr = ref 0.0 in
		    for i = 0 to l - 1 do
		      sr := !sr +. sqr (d.(i) -. r)
		    done;
		    !sr /. float_of_int l
		in
		  if sr /. r < 0.03
		  then incr resc
		  else incr ress;
		  (*Printf.printf "asd %f %f %f %f\t%f  %d\n"
		    mx my r sr (sr /. r) l*)
		*)
	    )
	)
      done
    done;
    let rays = List.sort compare !rays in
      Printf.printf "%d\n" !res;
      List.iter (Printf.printf "%d ") rays;
      Printf.printf "\n"


let () =
  let n = read_int () in
  let h = Hashtbl.create n in
  for i = 1 to n do
    let s = read_line () in
    let x = try Hashtbl.find h s with _ -> 0 in
    Hashtbl.replace h s (x+1);
    if x = 0 then
      print_endline "OK"
    else
      Printf.printf "%s%d\n" s x
  done

let n = read_int ();;                                                                                let users = Hashtbl.create 1000;;                                                                                for i = 1 to n do                                                                                let name = read_line () in                                                                                if Hashtbl.mem users name then begin                                                                                let _ = print_endline (name ^ (string_of_int (Hashtbl.find users name +1)) ^ "\n") in                                   Hashtbl.replace users name (Hashtbl.find users name+1)                                                          end                                                                                else begin                                                                                let _ = print_string "OK\n" in                                                                                Hashtbl.add users name 0                                                                                end                                                                                done;

open Printf
open String

module type DICTIONARY =
sig
  type key = string
  type 'a dict
  exception NotFound

  val make : unit -> 'a dict
  val insert : 'a dict -> key -> 'a -> 'a dict
  val lookup : 'a dict -> key -> 'a
  val map : ('a -> 'b) -> 'a dict -> 'b dict
end

(* implemented with association list *)
module AssocList : DICTIONARY =
struct
  type key = string
  type 'a dict = (key * 'a) list
  exception NotFound

  let make () : 'a dict = []
  let insert (d : 'a dict) (k : key) (x : 'a) : 'a dict = (k, x) :: d
  let rec lookup (d : 'a dict) (k : key) : 'a =
    match d with
      | [] -> raise NotFound
      | (k', x) :: rest ->
              if k = k' then x
              else lookup rest k
  let map (f : 'a -> 'b) (d : 'a dict) =
        List.map (fun (k, a) -> (k, f a)) d
end

(* implemented with higher-order function *)
module FunctionDict : DICTIONARY =
struct
    type key = string
    type 'a dict = string -> 'a
    exception NotFound

    let make () = fun _ -> raise NotFound
    let lookup (d : 'a dict) (key : string) : 'a = d key
    let insert (d : 'a dict) (k : key) (x : 'a) : 'a dict =
                fun k' -> if k = k' then x else d k'
    let map (f : 'a -> 'b) (d : 'a dict) = fun k -> f (d k)
end

(* a better association list verion *)
module SortedAssocList : DICTIONARY =
struct
  type key = string
  type 'a dict = (key * 'a) list
  exception NotFound

  let make() : 'a dict = []
  let rec insert (d : 'a dict) (k : key) (x : 'a) : 'a dict =
          match d with
          | [] -> (k, x) :: []
          | (k', x') :: rest ->
              match String.compare k k' with
                1 -> (k', x') :: (insert rest k x)
              | 0 -> (k, x) :: rest
              | -1 -> (k, x) :: (k', x') :: rest
              | _ -> failwith "Impossible"

  let rec lookup (d : 'a dict) (k : key) : 'a =
          match d with
            [] -> raise NotFound
          | (k', x) :: rest ->
              match String.compare k k' with
                0 -> x
              | -1 -> raise NotFound
              | 1 -> lookup rest k
              | _ -> failwith "Impossible"

  let map (f : 'a -> 'b) (d : 'a dict) =
           List.map (fun (k,a) -> (k, f a)) d
end

(* implemented with binary tree, logn loopup *)
module AssocTree : DICTIONARY =
struct
  type key = string
  type 'a dict = Empty | Node of key * 'a * 'a dict * 'a dict
  exception NotFound

  let make() : 'a dict = Empty

  let rec insert (d : 'a dict) (k : key) (x : 'a) : 'a dict =
          match d with
            Empty -> Node (k, x, Empty, Empty)
          | Node (k', x', l, r) ->
              match String.compare k k' with
                0 -> Node(k, x, l, r)
              | -1 -> Node(k', x', insert l k x, r)
              | 1 -> Node(k', x', l, insert r k x)
              | _ -> failwith "Impossible"

  let rec lookup (d : 'a dict) (k : key) : 'a =
          match d with
            Empty -> raise NotFound
          | Node(k', x, l, r) ->
              match String.compare k k' with
                0 -> x
              | -1 -> lookup l k
              | 1 -> lookup r k
              | _ -> failwith "Impossible"

  let rec map (f : 'a -> 'b) (d : 'a dict) =
          match d with
            Empty -> Empty
          | Node (k, x, l, r) -> Node (k, f x, map f l, map f r)
end

let tree = AssocTree.make ()

let n = Scanf.scanf "%d " (fun x -> x)

let myprint s i =
  let t = s^(string_of_int i) in
  printf "%s\n" t

let rec loop tr ii =
  if ii = 0 then
    ()
  else
    begin
      let open AssocTree in
      let s = Scanf.scanf "%s " (fun x -> x) in
      try
        let x = lookup tr s in
        myprint s (x+1); loop (insert tr s (x+1)) (ii-1)
      with
        NotFound -> printf "OK\n"; loop (insert tr s 0) (ii-1)
    end

 let () = loop tree n

let solve n =
  let tbl = Hashtbl.create 100000 in
  for i = 1 to n do
    let query = Scanf.scanf " %s" (fun x -> x) in
    if Hashtbl.mem tbl query
    then
      begin
	let v = Hashtbl.find tbl query in
	Hashtbl.add tbl query (v+1);
	Printf.printf "%s%d\n" query v;
      end
    else
      begin
	Hashtbl.add tbl query 1;
	Printf.printf "OK\n";
      end
  done

let _ =
  let n = Scanf.scanf " %d" (fun x -> x) in
  solve n

let acceptable = "OK\n"

let processName name table =
  if Hashtbl.mem table name
  then let currFreeNum = Hashtbl.find table name in
    begin
      Hashtbl.replace table name (currFreeNum + 1);
      Printf.sprintf "%s%d\n" name currFreeNum
    end
    else
      begin
        Hashtbl.add table name 1;
        acceptable
      end

let () =
  let numNames = Scanf.sscanf (read_line ()) "%d" (fun x -> x) in
  let table = Hashtbl.create numNames in
    for i = 1 to numNames do
      let currName = read_line () in
        print_string (processName currName table)
    done

let num = read_int () in
    let hbl = Hashtbl.create (num / 8) in
        for tot = 1 to num do
            let uc = read_line () in
            let i = try Hashtbl.find hbl uc with Not_found -> 0 in
            if i <> 0 then (print_string uc; print_int i; print_newline ()) else (print_endline "OK");
            Hashtbl.replace hbl uc (i + 1)
        done

open Hashtbl;;

let regs = read_int ();;

let users = Hashtbl.create 0;;

for i = 1 to regs do
	let name = read_line () in
	if Hashtbl.mem users name then begin
		let x = Hashtbl.find users name + 1 in
		let _ = print_string (name ^ (string_of_int x) ^ "\n") in
		Hashtbl.replace users name x

	end else begin
		Hashtbl.add users name 0;
		print_string "OK\n"
	end
done;


(* Petya and Construction Set
 * https://codeforces.com/contest/1214/problem/E *)

let ans =
  let n = read_int() in
  let ds = read_line()
           |> Str.split_delim (Str.regexp " ")
           |> List.map int_of_string in
  let prs = Array.make n (0, 0) in
  List.iteri (fun i k -> prs.(i) <- (k, i)) ds;
  Array.fast_sort (fun x y -> - (compare x y)) prs;
  let par = Array.make (n * 2 + 1) 0 in
  let lst = Array.make (n * 2) 0 in
  Array.iteri (fun i (_,k) -> lst.(i) <- 2 * k + 1) prs;
  let cur = ref n in
  let rec iter i cur =
    if i = n then cur
    else
      let (d, k) = prs.(i) in
      let ncur =
        if d + i = cur then
          (lst.(cur) <- 2*k+2;
           cur + 1)
        else (par.(2*k+2) <- lst.(d + i - 1);
              cur) in
      iter (i+1) ncur in
  let cur = iter 0 n in
  (* Array.iteri (fun i (d,k) ->
   *     if d + i = !cur then
   *       (lst.(!cur) <- 2*k+2;
   *        cur := !cur + 1)
   *     else
   *       par.(2*k+2) <- lst.(d + i - 1)
   *   ) prs; *)
  for i = 1 to cur - 1 do
    par.(lst.(i)) <- lst.(i-1)
  done;
  Array.iteri
    (fun i j -> if j = 0 then () else Printf.printf "%d %d\n" i j) par

(* let iteri_if action cond seq =
 *   let rec go i seq =
 *   match seq with
 *   | Seq.Nil -> ()
 *   | Seq.Cons (x, rest) -> (if cond i x then action i x else ()) ; go (i + 1) (rest ())
 *       in go 0 seq *)

let arr_iteri_if action cond arr =
  let rec go i =
    match i with
    | k when k = Array.length arr -> ()
    | _ -> (if cond i arr.(i) then action i arr.(i) else ()) ; go (i + 1)
  in go 0

let ans =
  let n = read_int() in
  let s = read_line() in
  let words = Str.split_delim (Str.regexp " ") s in
  let ds = List.map int_of_string words in
  let prs = Array.make n (0, 0) in
  List.iteri (fun i k -> prs.(i) <- (k, i)) ds;
  Array.fast_sort (fun x y -> - (compare x y)) prs;
  let par = Array.make (n * 2 + 1) 0 in
  let lst = Array.make (n * 2) 0 in
  Array.iteri (fun i (_,k) -> lst.(i) <- 2 * k + 1) prs;
  let cur = ref n in
  Array.iteri (fun i (d,k) ->
    if d + i = !cur then
      (lst.(!cur) <- 2*k+2;
      cur := !cur + 1)
    else
      par.(2*k+2) <- lst.(d + i - 1)
    ) prs;
  for i = 1 to !cur-1 do
    par.(lst.(i)) <- lst.(i-1)
  done;
  arr_iteri_if (fun i j -> Printf.printf "%d %d\n" i j)
    (fun i j -> j <> 0) par

let ans =
  let n = read_int() in
  let s = read_line() in
  let words = Str.split_delim (Str.regexp " ") s in
  let ds = List.map int_of_string words in
  let prs = Array.make n (0, 0) in
  List.iteri (fun i k -> prs.(i) <- (k, i)) ds;
  Array.fast_sort (fun x y -> - (compare x y)) prs;
  let par = Array.make (n * 2 + 1) 0 in
  let lst = Array.make (n * 2) 0 in
  Array.iteri (fun i (_,k) -> lst.(i) <- 2 * k + 1) prs;
  let cur = ref n in
  for i = 0 to n-1 do
    let (d, k) = prs.(i) in
    if d + i = !cur then
      (lst.(!cur) <- 2*k+2;
      cur := !cur + 1)
    else
      par.(2*k+2) <- lst.(d + i - 1)
  done;
  for i = 1 to !cur-1 do
    par.(lst.(i)) <- lst.(i-1)
  done;
  for i = 1 to n * 2 do
    if par.(i) = 0 then
      ()
    else
      Printf.printf "%d %d\n" i par.(i)
  done

let iteri_if action cond lst =
  let rec go i lst =
  match lst with
  | [] -> ()
  | x :: rest -> (if cond i x then action i x else ()) ; go (i + 1) rest
      in go 0 lst

let ans =
  let n = read_int() in
  let s = read_line() in
  let words = Str.split_delim (Str.regexp " ") s in
  let ds = List.map int_of_string words in
  let prs = Array.make n (0, 0) in
  List.iteri (fun i k -> prs.(i) <- (k, i)) ds;
  Array.fast_sort (fun x y -> - (compare x y)) prs;
  let par = Array.make (n * 2 + 1) 0 in
  let lst = Array.make (n * 2) 0 in
  Array.iteri (fun i (_,k) -> lst.(i) <- 2 * k + 1) prs;
  let cur = ref n in
  Array.iteri (fun i (d,k) ->
    if d + i = !cur then
      (lst.(!cur) <- 2*k+2;
      cur := !cur + 1)
    else
      par.(2*k+2) <- lst.(d + i - 1)
    ) prs;
  for i = 1 to !cur-1 do
    par.(lst.(i)) <- lst.(i-1)
  done;
  iteri_if (fun i j -> Printf.printf "%d %d\n" i j)
    (fun i j -> j <> 0) (Array.to_list par)

(* Petya and Construction Set
 * https://codeforces.com/contest/1214/problem/E *)

let ans =
  let n = read_int() in
  let ds = read_line()
           |> Str.split_delim (Str.regexp " ")
           |> List.map int_of_string in
  let prs = Array.make n (0, 0) in
  List.iteri (fun i k -> prs.(i) <- (k, i)) ds;
  Array.fast_sort (fun x y -> - (compare x y)) prs;
  let par = Array.make (n * 2 + 1) 0 in
  let lst = Array.make (n * 2) 0 in
  Array.iteri (fun i (_,k) -> lst.(i) <- 2 * k + 1) prs;
  let cur = ref n in
  let rec iter i cur =
    if i = n then ()
    else
      let (d, k) = prs.(i) in
      let ncur =
        if d + i = cur then
          (lst.(cur) <- 2*k+2;
           cur + 1)
        else (par.(2*k+2) <- lst.(d + i - 1);
              cur) in
      iter (i+1) ncur in
  iter 0 n;
  (* Array.iteri (fun i (d,k) ->
   *     if d + i = !cur then
   *       (lst.(!cur) <- 2*k+2;
   *        cur := !cur + 1)
   *     else
   *       par.(2*k+2) <- lst.(d + i - 1)
   *   ) prs; *)
  for i = 1 to !cur-1 do
    par.(lst.(i)) <- lst.(i-1)
  done;
  Array.iteri
    (fun i j -> if j = 0 then () else Printf.printf "%d %d\n" i j) par

(* #load "str.cma" *)

let () =
  let n = read_int() in
  let s = read_line() in
  let words = Str.split_delim (Str.regexp " ") s in
  let ds = List.map int_of_string words in
  print_int (List.fold_left (+) 0 ds)


let _ =
  let sb = Scanf.Scanning.stdib in
  let n = Scanf.bscanf sb "%d " (fun s -> s) in
  let a = Array.make n "" in
  let _ =
    for i = 0 to n - 1 do
      a.(i) <- Scanf.bscanf sb "%s " (fun s -> s)
    done;
  in
  let k = String.length a.(0) in
  let res = String.make k 'x' in
    for i = 0 to k - 1 do
      let c = ref '?' in
	for j = 0 to n - 1 do
	  if !c = '?' && a.(j).[i] <> '?' then (
	    c := a.(j).[i];
	    res.[i] <- !c;
	  ) else if !c <> '?' && a.(j).[i] <> '?' && a.(j).[i] <> !c then (
	    res.[i] <- '?'
	  )
	done
    done;
    Printf.printf "%s\n" res;

let n=read_int();;
let tab=Array.make (n+1) "";;
for i=1 to n do
   tab.(i)<-read_line()
done;;
let m=String.length(tab.(1));;
let vec=Array.make m ' ';;
for j=0 to m-1 do
   vec.(j)<-tab.(1).[j]
done;;
for i=2 to n do
   for j=0 to m-1 do
      if vec.(j)='?' then vec.(j)<-tab.(i).[j]
      else if tab.(i).[j]='?' then ()
      else if tab.(i).[j]<>vec.(j) then vec.(j)<-'!'
   done
done;;

let sol=tab.(1);;
for j=0 to m-1 do
   if vec.(j)='?' then sol.[j]<-'a'
   else if vec.(j)='!' then sol.[j]<-'?'
   else sol.[j]<-vec.(j)
done;;
print_string sol;;

open Scanf
open Printf

let read_int () = scanf " %d " (fun x -> x) in
let read_string () = scanf " %s " (fun x -> x) in

let n = read_int () in
let a = Array.init n (fun x -> (read_string ())) in
let m = String.length a.(0) in

let res = String.make m 'A' in

let upd i c =
    if c <> '?' then
        if res.[i] = 'A' || res.[i] = c then
            res.[i] <- c
        else
            res.[i] <- '?' in

Array.iter (String.iteri upd) a;
printf "%s\n" (String.lowercase res);;


let read_int () = Scanf.scanf " %d " (fun x -> x);;

let read_pair () = let a = read_int () in (a , read_int ());;

module Pair_set = struct
        type t = int*int
        let compare = compare
end;;

module Mytest = Set.Make (Pair_set);;

let n = read_int ();;

let data = Array.init n (fun i -> read_pair ());;
Array.sort compare data;;

let ans = ref 0 and _end = ref (-1) in
   for i = 0 to (n-1) do
           let first , second = data.(i) in
               if second < !_end then ans := !ans + 1
               else _end := second
   done;
   Printf.printf "%d\n" !ans;;

(*************** Ocaml stdio functions **********************)
let stdin_stream = Stream.of_channel stdin;;
let stdout_buffer = Buffer.create 65536;;
let rec gi() =
  match Stream.next stdin_stream with
    '-' ->  - (ri 0)
  | '+' ->  ri 0
  | '0'..'9' as c -> ri ((int_of_char c) - 48)
  | _ -> gi ()
and ri x =
  match Stream.next stdin_stream with
    '0'..'9' as c -> ri (((int_of_char c) - 48) + (x * 10))
  | _ -> x
;;
let flushout () = Buffer.output_buffer stdout stdout_buffer; Buffer.reset stdout_buffer;;
let putchar c =
  if (Buffer.length stdout_buffer) >= 65536 then flushout() else ();
  Buffer.add_char stdout_buffer c;;
let rec ppi i = if i < 10 then putchar (char_of_int (48 + i)) else (ppi (i / 10); putchar (char_of_int (48 + (i mod 10)))) ;;
let pi i = if i >= 0 then ppi i else (putchar ('-'); ppi (-i));;
let pa a = let n = Array.length a in Array.iteri (fun i j -> pi j; putchar (if i == (n-1) then '\n' else ' ')) a;;
(*************** Ocaml solution ******************************)
open Array
let main() =
  let n = gi() in
  let a = init n (fun i -> let ai = gi () in let bi = gi () in (ai, bi)) in
  let cmp a b = compare (fst a) (fst b) in
  stable_sort cmp a;
  let mx = ref 0 in
  let s = ref 0 in
  for i = 0 to (n-1) do
    let b = snd a.(i) in
    s := (!s) + (if b > (!mx) then 0 else 1);
    mx := max (!mx) b
    done;
  Printf.printf "%d\n" (!s)
  ;;
main();;
flushout ()

let read_int () = Scanf.bscanf Scanf.Scanning.stdib " %d " (fun x -> x)

module Pset = Set.Make (struct type t = int*int let compare = compare end)

let n = read_int()

let p = Array.make n (0,0)

let contained (a,b) s =
  let (l,_,_) = Pset.split (a,b) s in
    if Pset.is_empty l then false else
      let (ai,bi) = Pset.max_elt l in b < bi

let () =
  for i=0 to n-1 do
    let a = read_int() in
    let b = read_int() in
      p.(i) <- (a,b)
  done;
  Array.sort (fun (a,b) (c,d) -> compare (d-c) (b-a)) p;

  let s = ref Pset.empty in
  let count = ref 0 in
    for i=0 to n-1 do
      if not (contained p.(i) !s) then s := Pset.add p.(i) !s
      else count := !count + 1;
    done;

    Printf.printf "%d\n" !count

let getnum =
  let l = 512000 in
  let buf = String.make l ' ' in
  let s = ref 0 in
  let pos = ref 0 in
  let getc () =
    if !pos >= !s then (
      let new_s = input stdin buf 0 l in
	(*if new_s = 0 then raise End_of_file;*)
	s := new_s;
	if new_s = 0 then (
	  buf.[0] <- '\000';
	  s := 1;
	);
	pos := 0;
    );
    let c = buf.[!pos] in
      incr pos;
      c
  in
  let aux () =
    let n = ref 0 in
    let k = ref 1 in
      if !s - !pos < 50 then (
	let c = ref (getc ()) in
	  while !c <= ' ' do
	    c := getc ()
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := getc ();
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := getc ()
	  done;
	  !n * !k
      ) else (
	let c = ref (buf.[!pos]) in
	  incr pos;
	  while !c <= ' ' do
	    c := buf.[!pos];
	    incr pos;
	  done;
	  if !c = '-' then (
	    k := -1;
	    c := buf.[!pos];
	    incr pos;
	  );
	  while !c > ' ' do
	    n := !n * 10 + (Char.code !c - Char.code '0');
	    c := buf.[!pos];
	    incr pos;
	  done;
	  !n * !k
      )
  in
    aux

let _ =
  let n = getnum () in
  let c = Array.make n (0, 0) in
    for i = 0 to n - 1 do
      let a = getnum () in
      let b = getnum () in
	c.(i) <- (a, b)
    done;
    Array.sort compare c;
    let latest = ref 0 in
    let res = ref 0 in
      for i = 0 to n - 1 do
	let (_a, b) = c.(i) in
	  if b < !latest
	  then incr res;
	  latest := max !latest b
      done;
      output_string stdout (string_of_int !res);
      output_char stdout '\n';

let read_int () = Scanf.scanf " %d " (fun x -> x);;

let read_pair () = let a = read_int () in (a , read_int ());;

let n = read_int ();;

let events = Array.init (2*n) (fun i -> (read_int (),if i land 1 = 0 then 0 else 1));;

let compare x y = let a , b = x in let c , d = y in if a = c then 0 else if a > c then 1 else -1;;

Array.sort compare events;;

let ans = ref 0;;

let () =
   let cnt = ref 0 in
       for i = 0 to (2*n-1) do
           let first , second =  events.(i) in
               if second = 1 then begin
                       cnt := !cnt - 1;
                       if !cnt > 0 then ans := !ans + 1
                       else () end
               else cnt := !cnt + 1
       done;;

Printf.printf "%d\n" !ans;;


let rec gcd x y =
  if y == 0 then
    x
  else
    gcd y (x mod y)

let () =
  match read_line () |> Str.(split (regexp " ")) |> List.map int_of_string with
  | [n; k] ->
     let c = read_line () |> Str.(split (regexp " ")) |> List.map int_of_string in
     print_endline (
       if List.(fold_left gcd k (map (fun ci -> k / gcd k ci) c)) == 1 then
         "Yes"
       else
         "No"
       )
  | _ -> assert false

open Printf
open Scanf

let factor n = (* factor n into a list of prime powers *)
  let rec loop n p pow ac =
    let ac' = if pow>1 then (pow::ac) else ac in
    if n=1 then ac'
    else if n mod p = 0 then loop (n/p) p (pow*p) ac
    else loop n (p+1) 1 ac'
  in
  List.rev (loop n 2 1 [])

let rec forall i j f = (i>j) || ((f i) && forall (i+1) j f)

let read_int () = bscanf Scanning.stdib " %d " (fun x -> x)

let () =
  let n = read_int () in
  let k = read_int () in
  let c = Array.init n (fun _ -> read_int()) in

  let factors = factor k in

  let answer = List.exists (fun p ->
    forall 0 (n-1) (fun i -> c.(i) mod p <> 0)
  ) factors in

  if answer then printf "No\n" else printf "Yes\n"

open Printf
open Scanf

let factor n =
  let rec loop n p ac =
    if n=1 then ac
    else if p*p > n then (n::ac)
    else if n mod p = 0 then loop (n/p) p (p::ac)
    else loop n (p+1) ac
  in
  List.rev (loop n 2 [])

let rec forall i j f = (i>j) || ((f i) && forall (i+1) j f)

let read_int () = bscanf Scanning.stdib " %d " (fun x -> x)

let () =
  let n = read_int () in
  let k = read_int () in
  let c = Array.init n (fun _ -> read_int()) in

  let factors = List.sort_uniq compare (factor k) in

  let answer = List.exists (fun p ->
    forall 0 (n-1) (fun i -> c.(i) mod p <> 0)
  ) factors in

  if answer then printf "No\n" else printf "Yes\n"


type el = {
  i : int; (* node index *)
  mutable d : int; (* node degree *)
  mutable s : int; (* xor sum of neighbours *)
}

module H : sig
  type t
  val make : int -> t
  val add : t -> el -> unit
  val dec : t -> int -> unit
  val is_empty : t -> bool
  val pop : t -> el
  val get : t -> int -> el * int
end = struct
  type t = {
    mutable len : int;
    arr : el array;
    rev : int array;
  }

  let is_empty h = h.len = 0

  let make n = {
    len = 0;
    arr = Array.make n { i = -1; d = 0; s = 0 };
    rev = Array.make n 0;
  }

  let get h i =
    let j = h.rev.(i) in
    (h.arr.(j), j)

  let swap h i j =
    let e = h.arr.(i)
    and f = h.arr.(j) in
    h.arr.(i) <- f;
    h.arr.(j) <- e;
    h.rev.(e.i) <- j;
    h.rev.(f.i) <- i

  let rec dec h i =
    if i = 0 then ()
    else begin
      (* get parent *)
      let p = (i - 1) / 2 in
      (* if the child has smaller degree than parent *)
      if h.arr.(p).d > h.arr.(i).d then begin
        swap h i p;
        dec h p
      end
    end

  let rec inc h i =
    let l = 2 * i + 1
    and r = 2 * i + 2 in

    (* no children *)
    if l >= h.len then ()

    (* only left child *)
    else if r >= h.len then begin
      if h.arr.(i).d > h.arr.(l).d then begin
        swap h i l;
        inc h l
      end
    end

    (* both children *)
    else begin
      if h.arr.(i).d > h.arr.(l).d then
        (* right child is smallest *)
        if h.arr.(l).d > h.arr.(r).d then begin
          swap h i r;
          inc h r
        (* left child is smallest *)
        end else begin
          swap h i l;
          inc h l
        end
      (* right child is smaller *)
      else if h.arr.(i).d > h.arr.(r).d then begin
        swap h i r;
        inc h r
      end
    end

  let add h e =
    (* insert the element at the end of the heap *)
    h.arr.(h.len) <- e;
    h.rev.(e.i) <- h.len;

    (* bubble up to enforce the heap constraint *)
    dec h h.len;
    h.len <- h.len + 1

  let pop h =
    let e = h.arr.(0) in
    h.len <- h.len - 1;

    (* move the last element to the top *)
    swap h 0 h.len;

    (* bubble down *)
    inc h 0;

    (* return the element *)
    e
end

let () = Scanf.scanf "%d\n" (fun n ->
  let nodes = H.make n in
  let edges = ref [] in

  (* read nodes and populate the heap *)
  for i = 0 to n - 1 do
    let d, s = Scanf.scanf "%d %d\n" (fun d s -> (d, s)) in
    let el = { i; d; s } in
    H.add nodes el
  done;

  while not (H.is_empty nodes) do
    let e = H.pop nodes in
    match e.d with
    | 0 -> () (* isolated node; no edges *)

    | 1 -> (* leaf node, add edge to list *)
        edges := (e.i, e.s) :: !edges;
        let f, j = H.get nodes e.s in
        f.s <- f.s lxor e.i;
        f.d <- f.d - 1;
        H.dec nodes j;

    | _ -> failwith "Cycle detected"
  done;

  Printf.printf "%d\n" (List.length !edges);
  List.iter (fun (a, b) -> Printf.printf "%d %d\n" a b) !edges
)

let () = Scanf.scanf "%d\n" (fun n ->
  let s = Stack.create () in
  let e = ref [] in
  let a = Array.init n (fun i ->
    let d, x = Scanf.scanf "%d %d\n" (fun d s -> (d, s)) in
    if d = 1 then Stack.push i s;
    (d, x)
  ) in
  while not (Stack.is_empty s) do
    let i = Stack.pop s in
    let d', j = a.(i) in
    if d' = 1 then begin
      e := (i, j) :: !e;
      let d, x = a.(j) in
      a.(j) <- (d - 1, x lxor i);
      if d = 2 then Stack.push j s
    end
  done;
  Printf.printf "%d\n" (List.length !e);
  List.iter (fun (a, b) -> Printf.printf "%d %d\n" a b) !e
)


open Printf
open Scanf

let solve_one = (
)

let remove_last s = (String.sub s 0 ((String.length s) - 1))

let find_div7 s =
  let rec find_div7_try k =
    if k == 10 then 0
    else if ((s * 10 + k) mod 7) == 0 then (s * 10 + k)
    else find_div7_try (k + 1) in
  find_div7_try 0

let rec solve t =
  if t > 0 then (
    let s = read_line() in
    let v = int_of_string s in
    (
      if v mod 7 == 0 then v
      else find_div7 (int_of_string (remove_last s))
    )
    |> string_of_int
    |> print_endline;
    solve (t - 1)
  )
  else ()

let () =
  let t = int_of_string (read_line()) in
  solve t

Scanf.scanf "%d" (fun t ->
    for i = 1 to t do
        Printf.printf "%d\n" (
            Scanf.scanf " %d" (fun n ->
                if n mod 7 = 0 then n else
                    let n2 = n / 10 * 10 in
                    let rec loop i =
                        if (n2 + i) mod 7 = 0 then n2 + i else loop (i + 1)
                    in
                    loop 0
            )
        )
    done
)

open Printf
open Scanf

let solve_one = (
)

let remove_last s = (String.sub s 0 ((String.length s) - 1))

let find_div7 s =
  let rec find_div7_try k =
    if k == 10 then 0
    else if ((s * 10 + k) mod 7) == 0 then (s * 10 + k)
    else find_div7_try (k + 1) in
  find_div7_try 0

let rec solve t =
  if t > 0 then (
    let s = read_line() in
    print_endline (string_of_int (find_div7 (int_of_string (remove_last s))));
    solve (t - 1)
  )
  else ()

let () =
  let t = int_of_string (read_line()) in
  solve t


let ( ** ) a b = Int64.mul a b
let ( ++ ) a b = Int64.add a b
let ( -- ) a b = Int64.sub a b
let ( // ) a b = Int64.div a b

(* http://www.cs.cmu.edu/~quake/robust.html *)

let sq x = x ** x

let det ((a,b,c),(d,e,f),(g,h,i)) =
  a**(e**i -- f**h) -- b**(d**i -- f**g) ++ c**(d**h -- e**g)

(* This returns 0 if the four points are on the same circle.
   It returns >0 if going around the circle in the direction
   a --> b --> c then d is on the side of the circle pointed
   to by my left hand.  It returns >0 otherwise.  It's a fourth
   degree function in the given coordinates. *)

let incircle (ax,ay) (bx,by) (cx,cy) (dx,dy) =
  let row ax dx ay dy =
    let a = ax -- dx in
    let b = ay -- dy in
      (a, b, (sq a) ++ (sq b))
  in
    det (row ax dx ay dy, row bx dx by dy, row cx dx cy dy)

let (---) (x1,y1) (x2,y2) = (x1--x2, y1--y2);;
let (+++) (x1,y1) (x2,y2) = (x1++x2, y1++y2);;
let cross (x1,y1) (x2,y2) = (x1**y2) -- (y1**x2);;
let dot (x1,y1) (x2,y2) = (x1**x2) ++ (y1**y2);;

(* radius of a circle given three points from
   http://en.wikipedia.org/wiki/Circumscribed_circle *)

let length (x,y) =
  let (x,y) = (Int64.to_float x, Int64.to_float y) in
    sqrt (x*.x +. y*.y)

let radius a b c  =
  let a = a --- c in
  let b = b --- c in
    (length a) *. (length b) *. (length (a --- b)) /.
      (2.0 *. (abs_float (Int64.to_float (cross a b))))

(* this returns >0 if c on the left side of a-->b, <0 if on the right, and 0 if on. *)
let leftside a b c = cross (a---c) (b---c)

(* The following function takes a list of points as input, and returns true
   if it's smooth, that is, if none of the angles as we walk around the points
   subsumes more than half of the circle *)
let smooth_set a =
  let rec fold i j f init = if i>j then init else fold (i+1) j f (f i init) in
  let sum i j f = fold i j (fun i a -> (f i) +. a) 0.0 in
  let float_of_array a n =
    Array.init n (fun i -> let (xi, yi) = a.(i) in (Int64.to_float xi, Int64.to_float yi))
  in

  let a = Array.of_list a in
  let n = Array.length a in
  let af = float_of_array a n in
  let cx = (sum 0 (n-1) (fun i -> fst af.(i))) /. (float n) in
  let cy = (sum 0 (n-1) (fun i -> snd af.(i))) /. (float n) in
  let ang = Array.init n (fun i -> (atan2 ((fst af.(i) -. cx)) ((snd af.(i)) -. cy), i)) in
  let () = Array.sort compare ang in

  let rec loop i = i=n || (
    let j1 = snd ang.(i) in
    let j2 = snd (ang.((i+1) mod n)) in
    let j3 = snd (ang.((i+2) mod n)) in
    let v1 = a.(j3) --- a.(j1) in
    let v2 = a.(j2) --- a.(j3) in
      dot v1 v2 < 0L && loop (i+1)
  ) in
    loop 0

let read_int () = Scanf.bscanf Scanf.Scanning.stdib " %d " (fun x -> x)
let read_long () = Scanf.bscanf Scanf.Scanning.stdib " %Ld " (fun x -> x)
let read_pair _ = let u = read_long() in (u, read_long())

let print_smooth_set s =
  Printf.printf "smooth set: ";
  List.iter (fun (x,y) -> Printf.printf "(%Ld,%Ld) " x y) s;
  print_newline()

let () =
  let n = read_int() in
  let c = Array.init n read_pair in

  let bestr = ref (-1.0) in

    for i=0 to n-1 do
      for j=0 to n-1 do
	if i <> j then (
	  let prev = ref (-1) in
	    for k=0 to n-1 do
	      if k <> i && k <> j && (leftside c.(i) c.(j) c.(k) > 0L) then (
		if !prev = -1 || (incircle c.(i) c.(j) c.(!prev) c.(k)) > 0L then prev := k
	      )
	    done;
	    if !prev >0 then (
	      let bad = ref false in
	      let onlist = ref [] in
		for k=0 to n-1 do
		  let cval = incircle c.(i) c.(j) c.(!prev) c.(k) in
		    if cval = 0L then onlist := c.(k) :: !onlist
		    else if cval > 0L then bad := true
		done;
		if (not !bad) && (smooth_set !onlist) then (
(*		  print_smooth_set !onlist; *)
		  let r = radius c.(i) c.(j) c.(!prev) in
		    bestr := max r !bestr
		)
	    )
	)
      done
    done;

    if !bestr < 0.0 then Printf.printf "-1\n" else Printf.printf "%.6f\n" !bestr

(* O(n^2) Delaunay triangulation algorithm *)

let ( ** ) a b = Int64.mul a b
let ( ++ ) a b = Int64.add a b
let ( -- ) a b = Int64.sub a b
let ( // ) a b = Int64.div a b

(* http://www.cs.cmu.edu/~quake/robust.html *)

(* This returns 0 if the four points are on the same circle.
   It returns >0 if going around the circle in the direction
   a --> b --> c then d is on the side of the circle pointed
   to by my left hand.  It returns >0 otherwise.  It's a fourth
   degree function in the given coordinates. *)

let (---) (x1,y1) (x2,y2) = (x1--x2, y1--y2);;
let (+++) (x1,y1) (x2,y2) = (x1++x2, y1++y2);;
let cross (x1,y1) (x2,y2) = (x1**y2) -- (y1**x2);;
let dot (x1,y1) (x2,y2) = (x1**x2) ++ (y1**y2);;
let sq x = x ** x
let length (x,y) =
  let (x,y) = (Int64.to_float x, Int64.to_float y) in
    sqrt (x*.x +. y*.y)

let incircle (ax,ay) (bx,by) (cx,cy) (dx,dy) =
  let det ((a,b,c),(d,e,f),(g,h,i)) =
    a**(e**i -- f**h) -- b**(d**i -- f**g) ++ c**(d**h -- e**g)
  in

  let row ax dx ay dy =
    let a = ax -- dx in
    let b = ay -- dy in
      (a, b, (sq a) ++ (sq b))
  in
    det (row ax dx ay dy, row bx dx by dy, row cx dx cy dy)

(* radius of a circle given three points from
   http://en.wikipedia.org/wiki/Circumscribed_circle *)

let radius a b c  =
  let a = a --- c in
  let b = b --- c in
    (length a) *. (length b) *. (length (a --- b)) /.
      (2.0 *. (abs_float (Int64.to_float (cross a b))))

(* this returns >0 if c on the left side of a-->b, <0 if on the right, and 0 if on. *)
let leftside a b c = cross (a---c) (b---c)

module Pset = Set.Make (struct type t = int*int let compare = compare end)

(* takes as input an array of p of n points, and computes
   the Delaunay triangulation of them *)
let delaunay p n =

  let len2 (px,py) (qx,qy) = (sq (px--qx)) ++ (sq (py--qy)) in

  let rec closest (i,j) (bi,bj) dist =
    if j=n then (bi,bj) else
      let d = len2 p.(i) p.(j) in
      let next = if i+1<j then (i+1,j) else (0,j+1) in
	if bj=0 || d<dist then closest next (i,j) d else closest next (bi,bj) dist
  in
  let (bi,bj) = closest (0,1) (0,0) 0L in

  let order_face i j face nv =
    (* This returns an array of indices of this face in counterclockwise order.
       Think of i pointing up to j.  all the other points of the face are to the
       left of this line.  We sort them by taking the dot product of the i-->j vector
       with the normalized j-->k vector, and sort it in decreasing order.  *)
    let v = Array.make (nv-2) (0.0, 0) in
    let rec loadv k li = match li with [] -> () | h::li ->
      let a = p.(j) --- p.(i) in
      let b = p.(h) --- p.(j) in
      let dp = (Int64.to_float (dot a b)) /. (length b) in
	v.(k) <- (dp, h);
	loadv (k+1) li
    in
      loadv 0 face;
      Array.sort (fun a b -> compare b a) v;
      Array.init nv (fun k -> if k=0 then i else if k=1 then j else snd v.(k-2))
  in

  let rec loop (completed,todo) ac =
    match todo with
      | [] -> ac
      | (i,j)::todo ->
	  if Pset.mem (i,j) completed then loop (completed,todo) ac else
	    let rec findface ac k = if k=n then ac else
	      if k = i || k = j || (leftside p.(i) p.(j) p.(k) <= 0L) then findface ac (k+1) else
		if ac = [] then findface [k] (k+1) else
		  let ic = incircle p.(i) p.(j) p.(List.hd ac) p.(k) in
		    if ic > 0L then findface [k] (k+1)
		    else if ic = 0L then findface (k::ac) (k+1)
		    else findface ac (k+1)
	    in
	    let face = findface [] 0 in

	      if face = [] then loop (Pset.add (i,j) completed, todo) ac (* convex hull edge *)
	      else (
		let nv = 2 + (List.length face) in
		let v = order_face i j face nv in
		let rec process_face k (s,t) = if k = nv then (s,t) else
		  let l = (k+1) mod nv in
		  let s = Pset.add (v.(k), v.(l)) s in
		  let t = (v.(l), v.(k)) :: t in
		    process_face (k+1) (s,t)
		in
		  loop (process_face 0 (completed,todo)) (v::ac)
	      )
  in
    loop (Pset.empty, [(bi,bj); (bj,bi)]) []

(*----------------------------------------------------------------------*)

let read_int () = Scanf.bscanf Scanf.Scanning.stdib " %d " (fun x -> x)
let read_long () = Scanf.bscanf Scanf.Scanning.stdib " %Ld " (fun x -> x)
let read_pair _ = let u = read_long() in (u, read_long())

let () =
  let n = read_int() in
  let p = Array.init n read_pair in

  (* The following function takes an array of indices on a circle as input,
     and returns true if it's smooth, that is, if the polygon strictly
     contains the center.  *)
  let smooth_set a n =
    let rec loop i = i=n || (
      let j1 = a.(i) in
      let j2 = a.((i+1) mod n) in
      let j3 = a.((i+2) mod n) in
      let v1 = p.(j3) --- p.(j1) in
      let v2 = p.(j2) --- p.(j3) in
	dot v1 v2 < 0L && loop (i+1)
    ) in
      loop 0
  in

  let rec loop bestr f = match f with [] -> bestr
    | a::f ->
	let nv = Array.length a in
	let bestr = if smooth_set a nv then
	  max bestr (radius p.(a.(0)) p.(a.(1)) p.(a.(2))) else bestr
	in
	  loop bestr f
  in
  let bestr = loop (-1.0) (delaunay p n) in
    if bestr < 0.0 then Printf.printf "-1\n" else Printf.printf "%.6f\n" bestr