{"problem":{"name":"Reversible Cards","description":{"content":"We have $N$ cards numbered $1$ to $N$. Each side of each card has a color represented by a positive integer. One side of Card $i$ has a color $a_i$, and the other side has a color $b_i$. For each card","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc111_b"},"statements":[{"statement_type":"Markdown","content":"We have $N$ cards numbered $1$ to $N$. Each side of each card has a color represented by a positive integer.\nOne side of Card $i$ has a color $a_i$, and the other side has a color $b_i$.\nFor each card, you can choose which side shows up. Find the maximum possible number of different colors showing up.\n\n## Constraints\n\n*   $1 \\leq N \\leq 200000$\n*   $1 \\leq a_i,b_i \\leq 400000$\n*   All numbers in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$a_1$ $b_1$\n$a_2$ $b_2$\n$:$\n$a_N$ $b_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc111_b","tags":[],"sample_group":[["4\n1 2\n1 3\n4 2\n2 3","4\n\nWe can choose the sides with $1$, $3$, $4$, $2$ to have four colors."],["2\n111 111\n111 111","1\n\nThey are painted with just one color."],["12\n5 2\n5 6\n1 2\n9 7\n2 7\n5 5\n4 2\n6 7\n2 2\n7 8\n9 7\n1 8","8"]],"created_at":"2026-03-03 11:01:14"}}