  At the end of the 1960s, Knuth characterised the permutations that can be
sorted using a stack in terms of forbidden patterns. He also showed that they
are in bijection with Dyck paths and thus counted by the Catalan numbers.
Subsequently, Even \& Itai, Pratt and Tarjan studied permutations that can be
sorted using two stacks in parallel. This problem is significantly harder. In
particular, a sortable permutation can now be sorted by several distinct
sequences of stack operations. Moreover, in order to be sortable, a permutation
must avoid infinitely many patterns. The associated counting question has
remained open for 40 years. We solve it by giving a pair of functional
equations that characterise the generating function of permutations that can be
sorted with two parallel stacks. The first component of this system describes
the generating function Q(a,u) of square lattice loops confined to the positive
quadrant, counted by the length and the number of North-West and East-South
factors. Our analysis of the asymptotic number of sortable permutations relies
at the moment on two intriguing conjectures dealing with the series Q(a,u). We
prove that they hold for loops confined to the upper half plane, or not
confined at all. They remain open for quarter plane loops. Given the recent
activity on walks confined to cones, we believe them to be attractive per se.
