from sys import setrecursionlimit; setrecursionlimit(10**9)
N, A, B, C = map(int, input().split())
L = []
for _ in range(N):
    L.append(int(input()))

def argmin(array):
    return min(enumerate(array), key=lambda x:x[1])

def change_len(L):
    cons = 0
    R = list(map(lambda x: abs(x-A), L))
    cons += min(R)
    L.pop(argmin(R)[0])
    S = list(map(lambda x: abs(x-B), L))
    cons += min(S)
    L.pop(argmin(S)[0])
    T = list(map(lambda x: abs(x-C), L))
    cons += min(T)
    L.pop(argmin(T)[0])
    return cons

def rec(i, a, b, c, comb, cons):
    if i == N:
        if 0 not in [a, b, c]:
            comb.append([a, b, c, cons])
        return None

    # if n < 3:
    #     return
    v = 0 if a == 0 else 10
    rec(i+1, a+L[i], b, c, comb, cons+v)
    v = 0 if b == 0 else 10
    rec(i+1, a, b+L[i], c, comb, cons+v)
    v = 0 if c == 0 else 10
    rec(i+1, a, b, c+L[i], comb, cons+v)
    rec(i+1, a, b, c, comb, cons)
    return comb

comb = rec(0, 0, 0, 0, [], 0)
minval = 1000000
for c in comb:
    minval = min(minval, change_len(c[:3]) + c[3])
print(minval)