BinarySearch[list_, elem_] :=
	Module[{n0 = 1, n1 = Length[list], m},
		Print[{n0, n1}];
		While[n0 <= n1,
			m = Floor[(n0 + n1)/2];
			If[ list[[m]] == elem, Return[m] ];         (* found *)
			If[ list[[m]] < elem, n0 = m+1, n1 = m-1 ]; (* continue *)
			Print[{n0, n1}]
		];
		0  (* not found *)
	]
