output_description: Print the minimum cost incurred before reaching the goal.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M X
      A_1 A_2 ... A_M
attempt: import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
  
  sys.setrecursionlimit(10**7)
  inf = 10**20
  eps = 1.0 / 10**15
  mod = 10**9 + 7
  
  
  def LI():
      return [int(x) for x in sys.stdin.readline().split()]
  
  
  def LI_():
      return [int(x) - 1 for x in sys.stdin.readline().split()]
  
  
  def LF():
      return [float(x) for x in sys.stdin.readline().split()]
  
  
  def LS():
      return sys.stdin.readline().split()
  
  
  def I():
      return int(sys.stdin.readline())
  
  
  def F():
      return float(sys.stdin.readline())
  
  
  def S():
      return input()
  
  
  def pf(s):
      return print(s, flush=True)
  
  
  def main():
      n, m, x = LI()
      t = LI()
      a = collections.defaultdict(int)
      for c in t:
          a[c] = 1
      r = inf
      tr = 0
      for i in range(x + 1, n):
          tr += a[i]
      r = tr
      tr = 0
      for i in range(x - 1, -1, -1):
          tr += a[i]
      if r > tr:
          r = tr
  
      return r
  
  
  print(main())
  
problem_description: Statement
  
  There are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to
  right.
  
  Initially, you are in Square X. You can freely travel between adjacent
  squares. Your goal is to reach Square 0 or Square N. However, for each i = 1,
  2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i
  incurs a cost of 1. It is guaranteed that there is no toll gate in Square 0,
  Square X and Square N.
  
  Find the minimum cost incurred before reaching the goal.
samples: [{"input": "5 3 3\n    1 2 4", "output": "1\n    \n\nThe optimal solution is as follows:\n\n  * First, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n  * Then, travel from Square 4 to Square 5. This time, no cost is incurred.\n  * Now, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\n* * *"}, {"input": "7 3 2\n    4 5 6", "output": "0\n    \n\nWe may be able to reach the goal at no cost.\n\n* * *"}, {"input": "10 7 5\n    1 2 3 4 6 8 9", "output": "3"}]