Topological origin of the fermion sign problem