N teams play in a tournament. N teams first play each other in a round robin tournament. Then 8 top teams are selected and again they play in round robin format. Now top two teams play in a final. There are total 329 matches in the tournament, find the value of N.
1
20
2
24
3
22
4
25
5
26