Please read the following table in Markdown format and then answer the question according to the table. Table cells in one row are seperated by '|', and different rows are seperated by '
'.

Table:
| # | President | President's Party | Senate with | Senate opposed | House with | House opposed | Years served | Elections won |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | George Washington | Federalist-leaning | 8 | 0 | 6 | 2 | 8 | 2 |
| 2 | John Adams | Federalist | 4 | 0 | 4 | 0 | 4 | 1 |
| 3 | Thomas Jefferson | Democratic-Republican | 8 | 0 | 8 | 0 | 8 | 2 |
| 4 | James Madison | Democratic-Republican | 8 | 0 | 8 | 0 | 8 | 2 |
| 5 | James Monroe | Democratic-Republican | 8 | 0 | 8 | 0 | 8 | 2 |
| 6 | John Quincy Adams | National Republican | 2 | 2 | 2 | 2 | 4 | 1 |
| 7 | Andrew Jackson | Democratic | 8 | 0 | 8 | 0 | 8 | 2 |
| 8 | Martin Van Buren | Democratic | 4 | 0 | 4 | 0 | 4 | 1 |
| 9 | William Harrison | Whig | 0.1 | 0 | 0.1 | 0 | 0.1 | 1 |
| 10 | John Tyler | Whig/none | 4 | 0 | 2 | 2 | 4 | 0 |
| 11 | James Polk | Democratic | 4 | 0 | 2 | 2 | 4 | 1 |
| 12 | Zachary Taylor | Whig | 0 | 1 | 0 | 1 | 1 | 1 |
| 13 | Millard Fillmore | Whig | 0 | 3 | 0 | 3 | 3 | 0 |
| 14 | Franklin Pierce | Democratic | 4 | 0 | 2 | 2 | 4 | 1 |
| 15 | James Buchanan | Democratic | 4 | 0 | 2 | 2 | 4 | 1 |
| 16 | Abraham Lincoln | Republican | 4 | 0 | 4 | 0 | 4 | 2 |
| 17 | Andrew Johnson | Democratic | 0 | 4 | 0 | 4 | 4 | 0 |
| 18 | Ulysses Grant | Republican | 8 | 0 | 6 | 2 | 8 | 2 |
| 19 | Rutherford Hayes | Republican | 2 | 2 | 0 | 4 | 4 | 1 |
| 20 | James Garfield | Republican | 0 | 0.5 | 0.5 | 0 | 0.5 | 1 |
| 21 | Chester Arthur | Republican | 4 | 0 | 2 | 2 | 4 | 0 |
| 22 | Grover Cleveland | Democratic | 0 | 4 | 4 | 0 | 4 | 1 |
| 23 | Benjamin Harrison | Republican | 4 | 0 | 2 | 2 | 4 | 1 |
| 24 | Grover Cleveland | Democratic | 2 | 2 | 2 | 2 | 4 | 1 |
| 25 | William McKinley | Republican | 4 | 0 | 4 | 0 | 4 | 2 |
| 26 | Theodore Roosevelt | Republican | 8 | 0 | 8 | 0 | 8 | 1 |
| 27 | William Taft | Republican | 4 | 0 | 2 | 2 | 4 | 1 |
| 28 | Woodrow Wilson | Democratic | 6 | 2 | 6 | 2 | 8 | 2 |
| 29 | Warren Harding | Republican | 2 | 0 | 2 | 0 | 2 | 1 |
| 30 | Calvin Coolidge | Republican | 6 | 0 | 6 | 0 | 6 | 1 |
| 31 | Herbert Hoover | Republican | 4 | 0 | 2 | 2 | 4 | 1 |
| 32 | Franklin Roosevelt | Democratic | 12 | 0 | 12 | 0 | 12 | 4 |
| 33 | Harry Truman | Democratic | 6 | 2 | 6 | 2 | 8 | 1 |
| 34 | Dwight Eisenhower | Republican | 2 | 6 | 2 | 6 | 8 | 2 |
| 35 | John Kennedy | Democratic | 3 | 0 | 3 | 0 | 3 | 1 |
| 36 | Lyndon Johnson | Democratic | 5 | 0 | 5 | 0 | 5 | 1 |
| 37 | Richard Nixon | Republican | 0 | 6 | 0 | 6 | 6 | 2 |
| 38 | Gerald Ford | Republican | 0 | 2 | 0 | 2 | 2 | 0 |
| 39 | Jimmy Carter | Democratic | 4 | 0 | 4 | 0 | 4 | 1 |
| 40 | Ronald Reagan | Republican | 6 | 2 | 0 | 8 | 8 | 2 |
| 41 | George H. W. Bush | Republican | 0 | 4 | 0 | 4 | 4 | 1 |
| 42 | Bill Clinton | Democratic | 2 | 6 | 2 | 6 | 8 | 2 |
| 43 | George W. Bush | Republican | 4.5 | 3.5 | 6 | 2 | 8 | 2 |
| 44 | Barack Obama | Democratic | 6 | 0 | 2 | 4 | 6 | 2 |
| # | President | President's Party | Senate with | Senate opposed | House with | House opposed | Years served | Elections won |
Question:
how many years did ulysses grant serve?
Answer:
8