We classify possible configurations of domain walls in a cylindrical nanowire [1-3] using topology. Dipolar interactions induce effective shape anisotropy so that magnetization tends to be tangential to the surface locally and is parallel to the axis of the wire in the ground states. Topological defects in the bulk are Bloch points with integer skyrmion numbers [second homotopy group π2(S2)]. The surface anisotropy gives rise to surface defects (boojums) with integer vorticity [first homotopy group π1(S1)] and half-integer skyrmion number [relative second homotopy group π2(S2,S1)]. These defects are weakly bound by the easy-axis anisotropy into composite domain walls. Thus transformations and mergers of domain walls are constrained by the topological conservation laws. Long-lived textures left behind after annihilation of domain walls are classified by the third homotopy group π3(S2).