The answer to the OP's question is that it counts as one segment. You book DXB-HKG and travel DXB-HKG on a single flight number then it doesn't matter whether it stops en route or whether you get off the plane or not. You will get one boarding pass at DXB which takes you to HKG. You might have to, or be able to, get off the plane briefly at stops en route, but you would simply go to a holding area in the airport and then reboard after the plane has been cleaned / re-provisioned.