Flipping cards

[I have heard several versions of this problem. I first heard it from Bertrand Meyer, who got the problem from Yuri Gurevich.]

You’re given a regular deck of 52 playing cards. In the pile you’re given, 13 cards face up and the rest face down. You are to separate the given cards into two piles, such that the number of face-up cards in each pile is the same. In separating the cards, you’re allowed to flip cards over. The catch: you have to do this in a dark room where you cannot determine whether a card is face up or face down.