A quantitative definition of the near-accident concept