The nonlocal mean-field equation on an interval