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

void main() {
  long n = readln.strip.to!long;
  long a, b;
  readf("%d %d\n", &a, &b);
  long[] ps = readln.strip.split(" ").map!(to!long).array;

  auto s = ps.sort;
  auto x = s.lowerBound(a + 1).length;
  auto y = s.lowerBound(b + 1).length - x;
  auto z = n - x - y;

  writeln(min(x, min(y, z)));


}
