New answer (10/24): I think the following paper provides an elegant and efficient solution to your problem:
They show how to build a public-key encryption algorithm $E(\cdot)$ with the following two useful properties:
Additively homomorphic. Given $E(x)$ and $E(y)$, anyone can compute $E(x+y)$.
Can multiply (once). Given $E(x)$ and $E(y)$ (neither of which was generated as a result of a multiplication operation), anyone can compute $E(x \cdot y)$. You can use the result in addition operations, but you cannot use it in any multiplication operations (the result of a multiplication is tainted, and tainted values cannot be used as the input to another multiplication).
The consequence is that, given a quadratic multivariate polynomial $\Psi(x_1,\dots,x_n)$, and given $E(x_1),\dots,E(x_n)$, anyone can compute an encryption of $\Psi(x_1,\dots,x_n)$. This is super-useful for your situation.
In particular, in your situation, we can form the polynomial
$$\Psi(b_1,b_2,\dots,b_N) = \sum_{i \ne j} [b_i (1-b_j)].$$
Note that this is a quadratic multivariate polynomial, so given all of the $E(b_i)$'s, anyone can compute $E(\Psi(b_1,\dots,b_N))$. Also note that $R=\Psi(b_1,\dots,b_N)$, so we're trying to compute exactly the value of this polynomial.
This suggests a natural protocol for your problem, using a threshold version of the encryption scheme in the paper referenced above:
- Everyone jointly generates a public/private keypair for a threshold version of this scheme, such that the public key is known to all but the private key is shared among everyone (it requires cooperation of all $N$ parties to decrypt a ciphertext encrypted under this public key). The public key is broadcast to all $N$ participants.
- Each participant $i$ computes $E(b_i)$ and broadcasts $E(b_i)$ to all other participants. Everyone checks that this has been done honestly.
- Each participant computes $E(R) = E(\Psi(b_1,\dots,b_N))$ using the homomorphic properties of this encryption scheme and knowledge of $E(b_1),\dots,E(b_N)$. Everyone checks that they got the same value.
- The $N$ participants jointly use the threshold decryption protocol to recover $R$ from $E(R)$. (Note that they will only apply the threshold decryption protocol to this one ciphertext; the honest participants will refuse to participate in decrypting any other ciphertext.)
- Everyone proves somehow (maybe via ZK proofs) that they performed each step correctly.
You'd have to fill in some details, but I bet you could expand this sketch/outline to get a protocol that would solve your problem efficiently and securely.
My old answer:
I'd still look some more at a secure multiparty protocol for computing the sum $S = \sum_j b_j$.
The only way that this falls short of your scheme is it reveals one additional bit: it reveals whether $S<N/2$ or not. Does that one bit of information matter in your setting?
You say the sum $S$ is sensitive in your application. I hope you are aware that revealing the value $R$ reveals $S$ up to two possibilities (i.e., given $R$, we can compute a value $Q$ such that $S \in \{Q,N-Q\}$).
If you absolutely must conceal this information, here is a different approach that you might be able to make work. For each pair of parties $i,j$, securely compute $E(c_{i,j})$ where $c_{i,j} = b_i \oplus b_j$, $\oplus$ is the xor operation, and $E$ is some sort of additively-homomorphic encryption scheme. Then you might be able to compute $\sum_{i<j} c_{i,j}=R$ from this. There are some details to work out and the threat model may not be what you were hoping for, but it's possible you might be able to make something like this work.