On Integrating Direct Methods and Isomorphous Replacement Techniques. I. A Distribution Function for Quartet Invariants