How many presidents served in the armed forces?

Twenty-two of 41 presidents served in the armed forces.

They were:

George Washington
James Monroe
Andrew Jackson William
Henry Harrison
Zachary Taylor
James Buchanan
Abraham Lincoln
Andrew Johnson
Ulysses S. Grant
Rutherford B. Hayes
James A. Garfield
Benjamin Harrison
William McKinley
Theodore Roosevelt
Harry Truman
Dwight D. Eisenhower
John F. Kennedy
Richard M. Nixon
Gerald R. Ford
Jimmy Carter
Ronald Reagan
George Bush