Parse number of ports