How many gay us presidents have we had? ONE! James Buchanan
For many years in Washington, D.C. prior to the presidency, James Buchanan lived with William Rufus King, who was earlier Vice President under Franklin Pierce in 1853. King was referred to by Andrew Jackson as "Miss Nancy" while Aaron Brown called him "Buchanan's better half." Buchanan actually wrote long, intimate letters to King.
There were many rumors at the time that Buchanan was a homosexual. He is, after all, the only president to never marry in his life. But whether or not he was a homosexual continues to be a point of heated debate between historians.
Steve Tally discusses King and Buchanan's relationship in more depth in his book Bland Ambition: From Adams to Quayle--The Cranks, Criminals, Tax Cheats, and Golfers Who Made It to Vice President.