Chemical composition of the primary cosmic rays near the top of the atmosphere