The stability and breakup of nations: a quantitative analysis