Strong-coupling perturbation theory for the extended Bose-Hubbard model