Secure statistical analysis of distributed databases using partially trusted third parties. Manuscript in preparation