import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ky112233
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTollGates {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTollGates {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BTollGates solver = new BTollGates(); solver new BTollGates() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BTollGates {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        }

    } BTollGates public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        } solve {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        } int n = in.nextInt(); n in.nextInt() in.nextInt in int m = in.nextInt(); m in.nextInt() in.nextInt in int x = in.nextInt(); x in.nextInt() in.nextInt in Set<Integer> set = new HashSet<>(); set new HashSet<>() for (int i = 0; i < m; i++) set.add(in.nextInt()); int i = 0; int i = 0; i 0 i < m i m i++ i++ i set.add(in.nextInt()); set.add(in.nextInt()) set.add set in.nextInt() in.nextInt in int lcost = 0 lcost 0 rcost = 0 rcost 0 cost; cost for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            } int i = x + 1; int i = x + 1; i x + 1 x 1 i < n i n i++ i++ i {
                if (set.contains(i)) rcost++;
            } {
                if (set.contains(i)) rcost++;
            } if (set.contains(i)) rcost++; set.contains(i) set.contains set i rcost++ rcost for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            } int i = x - 1; int i = x - 1; i x - 1 x 1 i > 0 i 0 i-- i-- i {
                if (set.contains(i)) lcost++;
            } {
                if (set.contains(i)) lcost++;
            } if (set.contains(i)) lcost++; set.contains(i) set.contains set i lcost++ lcost cost = Math.min(lcost, rcost) cost Math.min(lcost, rcost) Math.min Math lcost rcost out.println(cost) out.println out cost int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTollGates {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTollGates {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ky112233
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTollGates solver = new BTollGates();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTollGates {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < m; i++) set.add(in.nextInt());
            int lcost = 0, rcost = 0, cost;
            for (int i = x + 1; i < n; i++) {
                if (set.contains(i)) rcost++;
            }
            for (int i = x - 1; i > 0; i--) {
                if (set.contains(i)) lcost++;
            }
            cost = Math.min(lcost, rcost);
            out.println(cost);
        }

    }
}

