On the rank of the flat unitary summand of the Hodge bundle