object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val n,m,x = sc.nextInt()
  val a = List.fill(m)(sc.nextInt)
  val costA = (x+1 to n-1).map(i=>if(a.contains(i)){1}else{0}).sum
  val costB = (1 to x-1).map(i=>if(a.contains(i)){1}else{0}).sum
  println(Array(costA,costB).min)
}