There were 60 pies before the bake sale started.
Explanation
Suppose, there were [tex]x[/tex] number of pies before the bake sale started.
As Mary set aside 2 pies for herself at the beginning of the bake sale, so the remaining number of pies [tex]=x-2[/tex]
Karen then bought half of the remaining pies for her birthday party. That means, the remaining number of pies after Karen bought will be: [tex]\frac{x-2}{2}[/tex]
10 more pies were sold during the sale and there were 19 pies remaining when the sale was over. So, the equation will be......
[tex]\frac{x-2}{2}-10=19\\ \\ \frac{x-2}{2}=29\\ \\ x-2= 2*29=58\\ \\ x= 58+2=60[/tex]
So, there were 60 pies before the bake sale started.