The more interesting question is if you can have a functioning democracy with only two parties. If you look at the current US situation I see no reason to be optimistic about it.
The problem looks unsolvable. A root cause is the winner-takes-all voting system which makes it almost impossible for new parties to get elected. And none of the two parties has a real incentive to change the voting system.