function Main(s) {
  s = s.split("\n");
  var a = s[1].split(" ").map(a => +a);
  s = s[0].split(" ").map(a => +a);
  var l = 0, r = 0, k = 0;
  for(var i = 1; i < s[0]; i++){
    if(i === a[k]){
      k++;
      if(i < s[2])l++;
      else r++;
    }
  }
  console.log(l < r ? l : r);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));