Nekrasov functions and exact Bohr-Sommerfeld integrals