Covalency:
The number of bonds an atom can form within a molecule is known as its covalency. The simplest atom, hydrogen has the capacity to form one bond; that is, it can attach itself to one other atom to form a molecule. Oxygen atoms can form two bonds and nitrogen atoms can form three within a molecule.
To calculate the formula for a molecule the covalencies of the atoms must be balanced. Take for instance the molecule methane made from carbon and hydrogen atoms. Carbon with covalency 4 is matched by 4 hydrogen atoms each with covalency 1.