import java.util.Scanner import scala.collection.mutable.ListBuffer object no26{ def main(args:Array[String]):Unit={ val scan = new Scanner(System.in) val n = scan.nextInt val m = scan.nextInt var list:ListBuffer[Int] = ListBuffer(0,0,0) list(n-1) += 1 for(i <- 1 to m){ val p = scan.nextInt - 1 val q = scan.nextInt - 1 val tmp = list(p) list(p) = list(q) list(q) = tmp } var res = 0 for(j <- list){ res += 1 if (j == 1) println(res) } } }