In this article, using archival sources we show how mathematical knowledge and methods helped to solve the problem of the election of the first exclusively Bulgarian government in the peaceful election in 1879 and 1880. We will describe the situation in Bulgaria, and especially the role of the mathematician, politician and financier Ivan Petrov Salabashev (1853-1924).