Section 39. In counting votes when the ballots are removed from the ballot box, they shall first be sorted into piles, one for each party, and each pile shall be counted and sealed separately. Votes shall be counted only for nominations of the party on whose ballot they appear.