Joint probability distribution of structure factors and the phase problem