Energy levels of a nonlocal functional