There is a total gain of $38$ ATP molecules during aerobic respiration of one molecules of glucose. Out of these two molecules of ATP are required for transporting the NADH produced in glycolysis (in cytoplasm) into the mitochondria for further oxidation, hence the net gain of ATP is $36$ molecules.