Recently there is increasing interest in studying the limit cycles of the piecewise differential systems due to their many applications. In this paper we prove that the linear system (x) over dot = y, (y) over dot = -x, can produce at most seven crossing limit cycles for n >= 4 using the averaging theory of first order, where the bounds <= 4 for n >= 4 even and the bounds <= 7 for n >= 5 odd are reachable, when it is perturbed by discontinuous piecewise polynomials formed by two pieces separated by the curve y = x(n) (n >= 4), and having in each piece a quadratic polynomial differential system. Using the averaging theory of second order the perturbed system can be chosen in such way that it has 0, 1, 2, 3, 4, 5 or 6 crossing limit cycles for n >= 4 even and, furthermore, under a particular condition we prove that the number of crossing limit cycles does not exceed 9 (resp., 11) for 4 <= n <= 74 even (resp., n >= 76 even). The averaging theory of second order produces the same number of crossing limit cycles as the averaging theory of first order if n >= 5 is odd. The main tools for proving our results are the new averaging theory developed for studying the crossing limit cycles of the discontinuous piecewise differential systems, and the theory for studying the zeros of a function using the extended Chebyshev systems.