using System; using System.Linq; using System.Collections.Generic; public static class Program{ public static void Main() { int n=int.Parse(Console.ReadLine()); var graph=Enumerable.Range(0,n) .Select(_=>new List()).ToArray(); for(int i=0;idfs=null; dfs=x=>{ ckd[x]=true; foreach(int y in graph[x]){ if(!ckd[y])dfs(y); } }; int counter=0; for(int i=0;i