How many years was the republican party in control of congress before they lost power to the democratic party in 1876?