durgesh-and-string-2

My dear friend Durgesh loves math very much. He likes to challenge himself with different maths puzzle. Unlike many of us he has maths problem coming in his dreams! One night he dreamed of the following problem.
Given a set of binary strings and number of zeros and ones. Find out maximum number of strings that can created from the given set  using given zeros and ones. You can only use one '0' or '1' once only. It is not necessary that you use all the zeros and ones given.
As he is very lazy he has asked you to solve this problem for him.

Input:

First line contain N, number of strings in the set.
N lines follows, each consist of string (of '0' and '1' ).
Last line contain two integers denoting number of ones and zeros respectively.

Output:

One line containing the required output.

Constraint:

0 < N < 18

0 < Number of zeros ≤ 500

0 < Number of ones  ≤ 500

SAMPLE INPUT
4
00
11
01
10
2 4

SAMPLE OUTPUT
3

Source: hackerearth | Difficulty: EASY


Solutions: