import std.stdio,
       std.string,
       std.conv,
       std.range,
       std.algorithm;

void main() {
  int[] buf = readln.chomp.split.to!(int[]);
  int n = buf[0], m = buf[1], x = buf[2];
  int[] A = readln.chomp.split.to!(int[]);

  int count_left,
      count_right;
  for (int i = x - 1; i >= 1; i--) {
    if (canFind(A, i)) {
      count_left++;
    }
  }
  for (int i = x + 1; i <= n; i++) {
    if (canFind(A, i)) {
      count_right++;
    }
  }

  writeln(min(count_left, count_right));
}
