CPython lite logoProblemsContests

I. Equalization Upsolve

You are given an array of numbers with n elements.

You can perform the following operation on the array:

  • Take any number and add to it a or b or cThe elements with the same values increase simultaneously.

You must make all the values of the array elements the same with a minimum number of operations.


Input

In the first line, a natural number n(1n5105).

In the second line, the elements of the array ai(1ai5105).

In the third line, three distinct natural numbers a,b,c(1a,b,c4).

Output

Output the minimum number of operations in one line.


Sample input 1

3
2 8 5
1 2 4

Sample output 1

3

Sample input 2

7
3 9 8 7 8 7 10
2 4 3

Sample output 2

5

Sample input 3

10
4 6 7 1 13 15 15 13 16 1
3 1 2

Sample output 3

7