function conta_zeros (var mat: tipo_matriz): integer;
var
   c, i, j: integer;
begin
   c := 0;
   for i := 1 to n_linhas do
      for j := 1 to n_colunas do
	 if (mat[i, j] = 0) then
	    c := c + 1;
   conta_zeros := c;
end;
