The formula C_nH_(2n+2) is important. Try it for hexanes, n=6, heptane, n=7, methane. Are the formulae consistent?
Of course halogens substitute for hydrogen, i.e. C_nH_(2n+1)X. Each 2 hydrogens less than the saturated formula, C_nH_(2n+2) corresponds to an olefinic bond, i.e. C=C, C=N, C=O, OR a ring junction. Is it consistent for cylcohexane?
For compounds containing nitrogen, subtract NH; try it for prussic acid, HC-=N, clearly 3""^@ of unsaturation. The degree of unsaturation is a very useful parameter to characterize an organic formula. An example is one of the simplest organic molecules, C_6H_6, benzene. Given my spray, this has 4 degrees of unsaturation. And indeed benzene has the equivalent of 3 "double bonds" and a ring. Try this treatment with toluene, acetone, ethylene, acetylene, as well as say decane, and decene, and cyclohexane. If you have any queries, state them here.