Topological charges and the genus of surfaces