import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {

    auto tmp = readln.split.to!(int[]);
    auto M = tmp[0], N = tmp[1], X = tmp[2];
    auto a = readln.split.to!(int[]);

    auto left = a.filter!(x => x < X).walkLength;
    auto right = a.filter!(x => x > X).walkLength;

    writeln(min(left, right));
}

