The Russian Soviet Federative Socialist Republic (Russian SFSR or RSFSR; Russian: Росси́йская Сове́тская Федерати́вная Социалисти́ческая Республика, tr. Rossiyskáya Sovetskáya Federatívnaya Socialistícheskaya Respublika, IPA: (listen)), previously known as the Russian Soviet Republic and the Russian Socialist Federative Soviet Republic, as well as being unofficially known as the Russian Federation, Soviet Russia, or simply Russia, was an independent state from 1917 to 1922, and afterwards the largest, most populous and most economically developed of the 15 Soviet socialist republics of the Soviet Union (USSR) from 1922 to 1990, then a sovereign part of the Soviet Union with priority of Russian laws over Union-level legislation in 1990 and 1991, during the last two years of the existence of the USSR. The Russian Republic comprised sixteen smaller constituent units of autonomous republics, five autonomous oblasts, ten autonomous okrugs, six krais and forty oblasts. Russians formed the largest ethnic group. The capital of the Russian SFSR was Moscow and the other major urban centers included Leningrad, Novosibirsk, Yekaterinburg, Nizhny Novgorod and Samara. The economy of Russia became heavily industrialized, accounting for about two-thirds of the electricity produced in the USSR. By 1961, it was the third largest producer of petroleum due to new discoveries in the Volga-Urals region and Siberia, trailing in production to only the United States and Saudi Arabia. In 1974, there were 475 institutes of higher education in the republic providing education in 47 languages to some 23,941,000 students. A network of territorially organized public-health services provided health care. After 1985, the 'perestroika' restructuring policies of the Gorbachev administration relatively liberalised the economy, which had become stagnant since the late 1970s under General Secretary Leonid Brezhnev, with the introduction of non-state owned enterprises such as cooperatives. The Russian Soviet Republic was proclaimed on 7 November 1917 (October Revolution) as a sovereign state and the world's first constitutionally socialist state with the ideology of Communism. The first Constitution was adopted in 1918. In 1922, the Russian SFSR signed the Treaty on the Creation of the USSR officially setting up of the Union of Soviet Socialist Republics. The 1977 Soviet Constitution stated that ' Union Republic is a sovereign state that has united in the Union' and 'each Union Republic shall retain the right freely to secede from the USSR'. On 12 June 1990, the Congress of People's Deputies adopted the Declaration of State Sovereignty, established separation of powers (instead of Soviet form of government), established citizenship of Russia and stated that the RSFSR shall retain the right of free secession from the USSR. On 12 June 1991, Boris Yeltsin (1931–2007), supported by the Democratic Russia pro-reform movement, was elected the first and only President of the RSFSR, a post that would later become the presidency of the Russian Federation. The August 1991 Soviet coup d'état attempt with the temporary brief internment of President Mikhail Gorbachev destabilised the Soviet Union. On 8 December 1991, the heads of Russia, Ukraine and Belarus signed the Belavezha Accords. The agreement declared dissolution of the USSR by its original founding states (i.e., renunciation of the 1922 Treaty on the Creation of the USSR) and established the Commonwealth of Independent States (CIS) as a loose confederation. On 12 December, the agreement was ratified by the Supreme Soviet (the Russian SFSR parliament); therefore the Russian SFSR had renounced the Treaty on the Creation of the USSR and de facto declared Russia's independence from the USSR itself and the ties with the other Soviet Socialist Republics. On 25 December 1991, following the resignation of Gorbachev as President of the Soviet Union (and former General Secretary of the Communist Party of the Soviet Union), the Russian SFSR was renamed the Russian Federation, with President Yeltsin re-establishing the sovereign and independent state (see history of Russia from 1991 onwards). With the lowering at 12 midnight of the flag of the now former USSR from the top of the Kremlin Senate building in Moscow on 26 December 1991, the USSR was self-dissolved by the Soviet of the Republics, which by that time was the only functioning chamber of the parliamentary Supreme Soviet (the other house, Soviet of the Union, had already lost the quorum after recall of its members by the several union republics). After dissolution of the USSR, Russia declared that it assumed the rights and obligations of the dissolved central Soviet government, including UN membership and permanent membership on the Security Council, but originally excluding foreign debt and foreign assets of the USSR (also parts of the former Soviet Red Army and nuclear weapons remained under overall CIS command as CIS United Armed Forces ). The 1978 RSFSR Constitution was amended several times to reflect the transition to democracy, private property and market economy. The new Russian Constitution, coming into effect on 25 December 1993 after a constitutional crisis, completely abolished the Soviet form of government and replaced it with a semi-presidential system. Under the leadership of Vladimir Lenin (1870–1924) and Leon Trotsky (1879–1940), the Bolshevik communists established the Soviet state on 7 November 1917, immediately after the interim Russian Provisional Government, most recently led by opposing democratic socialist Alexander Kerensky (1881–1970), which governed the new Russian Republic after the overthrow of the Russian Empire government of the Romanov imperial dynasty of Czar Nicholas II the previous March, was now itself overthrown during the following October Revolution, the second of the two Russian Revolutions that turbulent year of 1917 during World War I. Initially, the state did not have an official name and wasn't recognized by neighboring countries for five months. Meanwhile, anti-Bolsheviks coined the mocking label Sovdepia for the nascent state of the Soviets of Workers' and Peasants' Deputies. On 25 January 1918, the third meeting of the All-Russian Congress of Soviets renamed the unrecognised state the Russian Soviet Republic. The Treaty of Brest-Litovsk was signed on 3 March 1918, giving away much of the border lands in the west of the former Russian Empire to the German Empire (Germany) in exchange for peace during the last year of the rest of World War I. On 10 July 1918, the Russian Constitution of 1918 renamed the country the Russian Socialist Federative Soviet Republic. By 1918, during the subsequent Russian Civil War several states within the former Russian Empire seceded, reducing the size of the country even more.