I know of a solution. But this has a limitation that information is partially passed around and there needs some trust level. I'm wondering if any variant of public-private key (e.g. RSA) algorithm can solve this.
--Spoiler Alert: solution without RSA--
Salary of A: x Salary of B: y Salary of C: z Salary of D: u A passes to B (x + a) where a is a number that A knows B takes this a passes to C (x + y + a + b) C takes this and passes to D (x + y + z + a + b + c) D takes this and passes to A (x + y + z + u + a + b + c + d) Now one after another they strip their constants. Ex: A now passes to B: x + y + z + u + b + c + d (She has stripped of A) and B passes to C after stripping of her constant (b). Thus Finally D gets x + y + z + u + d. She takes away her constant and now she has x + y + z + u. So she can publish the average (x + y + z + u) /4.