We provide a simple explanation of complex magnetic patterns observed in ferromagnetic nanostructures. To this end we identify elementary topological defects in the field of magnetization: ordinary vortices in the bulk and vortices with half-integer winding numbers confined to the edge. Domain walls found in experiments and numerical simulations in strips and rings are composite objects containing two or more of the elementary defects.