Drilling down into the Oct. 19 election results, which gave Justin Trudeau and the Liberals 39.5 per cent of the popular vote and 184 seats in the House of Commons, reveals how new voters tipped the scales.

CBC News has published complete riding results here, with seat numbers, demographics, polling numbers and more, but here we add some numbers on gains and losses, close races, second-place finishes, and comparisons to the last election.

Total votes

The total number of votes for the parties shows that only the NDP lost a big number of votes — almost a million. The Conservatives stayed at about the same number, while the Liberals gained more than four million, suggesting they may have received the votes of a huge share of the new voters in this election.

Vote change in numbers and percentages for the top five parties:

Comparing votes: 2015 and previous election Party Change in vote totals from previous election Percentage increase/decrease Liberal +4,133,373 +59.66% Conservative –54,268 –0.97% NDP –963,704 –27.85% BQ –80,515 –9.84% Green +38,860 +6.42%

(The table compares the preliminary result for 2015 to the total vote in 2011, adjusted for the 15 byelections since then.)

The larger turnout — at least 68.5 per cent compared with 61.1 per cent in 2011 — boosted the total number of votes cast. Turnout this year was the highest since 1993, when it was 70.9 per cent.

Despite getting 80,000 fewer votes this election, the Bloc Quebecois went from winning four seats in 2011 to 10 seats on Monday.

Seat gains, losses, and tight races

The BQ gained nine seats from the NDP, while losing three of the seats they previously held.

Overall, here are the seat changes:​

87 gains, Liberals from Conservatives.

56 gains, Liberals from NDP.

2 gains, Liberals from BQ.

8 gains, NDP from Conservatives.

6 gains, Conservatives from NDP.

1 gain, Conservatives from BQ.

9 gains, BQ from NDP.

The only parties that both gained and lost seats to each other were the Conservatives and the NDP.

In 22 ridings, the margin of victory was 1.5 per cent or less. The narrowest margin was in Winnipeg's Elmwood-Transcona, where, as of Oct. 21, the NDP's Daniel Blaikie won by 51 votes, 0.1 per cent, over his Conservative opponent, Lawrence Toet, the MP since 2011.

Here's how the parties fared in those 22 ridings, showing their number of wins and their number of second-place finishes: The NDP won half of the tight races, and Liberals came second in 13.

22 tight races (wins by 1.5 per cent or less) Party Wins In 2nd place NDP 11 3 Liberal 5 13 Conservative 4 6 Bloc Quebecois 2 0

Vote extremes

Liberal Judy Foote won the highest share of the vote, 81.8 per cent, in Bonavista–Burin–Trinity. She has represented the Newfoundland south shore riding since 2008.

Kevin Sorenson, running in Alberta's Battle River–Crowfoot, had the second-highest share of the popular vote and he also received more votes than any other candidate across Canada. Sorenson has been an MP since 2000 and is the outgoing minister of state for finance.

Running for the Liberals in the Ottawa riding of Orleans, Andrew Leslie had the second-highest number of votes of any candidate. Leslie led Canada's army from 2006 to 2010.

Orleans had the most ballots cast and the second-highest voter turnout of any riding. The highest turnout honours go to nearby Ottawa Centre, with 85 per cent.

The winning candidate with the smallest share of the vote — just 28.5 per cent — was newcomer Brigitte Sansoucy, running for the NDP in Quebec's Saint-Hyacinthe–Bagot riding, while the Liberals and the BQ were nipping at her heels.

Niagara Falls riding had more people on the voters list than any other riding, 102,602, with Edmonton–Wetaskiwin next at 98,502.

Canada's largest electoral district by area, Nunavut, had the smallest number of voters listed, 19,223. (The median size for a riding is about 78,600 voters.)

Second place

Canada has first-past-the-post elections, but second-place finishers may think they stand the best chance of defeating the incumbent next time. The Conservatives and Liberals came second most frequently, but note that the NDP came second to the Liberals in 64 ridings.

They finished second to the Liberals in eight of Toronto's 12 core ridings, six of them won by the NDP in 2011. The Liberals also won the other Toronto ridings — 25 in all.

The Green Party came second in B.C.'s Victoria riding and third in four other ridings, along with leader Elizabeth May's re-election in Saanich-Gulf Islands.

These were the nationwide numbers for second-place with the number of times another party finished in first:

Second-place finishes by party Party 2nd place finishes No. of those seats won by: BQ 11 8 Liberal 3 NDP Green 1 1 NDP Conservative 123 111 Liberal 11 NDP 1 Green Liberal 118 81 Conservative 29 NDP 8 BQ NDP 84 64 Liberal 18 Conservative 2 BQ



Thirty candidates received 40 per cent or more of the votes but still lost. In St. John's East, incumbent NDP MP Jack Harris got 45.3 per cent of the popular vote, but Liberal Nick Whalen won.

Two candidates with more than 30 per cent of the popular vote finished in third place: Liberal Steve Powrie in B.C.'s Kamloops-Thompson-Cariboo, with 30.5 per cent, and in Desnethé-Missinippi-Churchill River, Saskatchewan's most northerly riding, Conservative Rob Clarke finished third with 30.2 per cent of the votes. He had represented the area — a new constituency — since 2008.

10 indigenous MPs, 6 LGBT MPs

CBC News has elsewhere tabulated the numbers for women as candidates and getting elected. A research group, LGBTQ Representation and Rights, counted 21 candidates as LGBTQ and out, with six winning their ridings, four Liberals and two New Democrats. They counted six LGBT winners in the three previous elections, too.

The next Parliament will have 10 indigenous members of Parliament, three more than after the 2011 election. The Liberals elected eight indigenous MPs, and the NDP elected two.

How pollsters did

Seven pollsters were in the field on or after Oct. 15 and released poll results before the election. Here are the midpoints of their findings for the top three parties, compared with the actual vote:

The polls that included results from Sunday showed support moving from the NDP to the Liberals.