Solution (source code)

= Solution

For the <connected sum of surfaces>, remove an embedded open disc from each <surface> and identify the resulting boundary circles by a homeomorphism. The resulting closed connected <surface> is denoted $M\#N$.

Removing a disc decreases the <Euler characteristic> by one. Gluing the remaining surfaces along their common boundary subtracts the characteristic of a circle, which is zero. Thus
$$
\boxed{\chi(M\#N)=\chi(M)+\chi(N)-2.}
$$
This can be verified by choosing matching subdivisions of the boundary circles and counting the vertices and edges identified in the gluing.