using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        var N = cin.nextInt();
        var A = cin.nextInt();
        var B = cin.nextInt();
        var C = cin.nextInt();
        int[] L = new int[N];
        for(var i = 0;i < N; i++)
        {
            L[i] = cin.nextInt();
        }
        // 全通り試しにいく

        int[,] sw = new int[N, 2];
        var ret = (int)Math.Pow(10, 9);
        while(sw.ToList().Sum() < N * 3)
        {
            sw = nextSw(sw);
            ret = Math.Min(ret, mpcalc(A, B, C, sw, L));
        }

        Console.WriteLine(ret);
    }

    int[] nextSw(int[] sw)
    {
        int[] ret = sw;
        int pre = sw[0];
        var judge = false;
        for(var i = 0;i < ret.Length; i++)
        {
            if(pre != ret[i])
            {
                ret[i] = ret[i] + 1;
                judge = true;
                break;
            }
        }
        if (!judge)
        {
            ret[0] = ret[0] + 1;
        }

        return ret;
    }

    int mpcalc(int A, int B, int C, int[] sw, int[] L)
    {
        var ret = 0;
        List<int> AL = getList(sw, L, 1);
        List<int> BL = getList(sw, L, 2);
        List<int> CL = getList(sw, L, 3);

        if (AL.Count == 0 || BL.Count == 0 || CL.Count == 0)
        {
            return (int)Math.Pow(10, 9);
        }

        // それぞれの合計を計算して、MPを加算
        var a = AL.Sum();
        var b = BL.Sum();
        var c = CL.Sum();
        ret = (AL.Count() + BL.Count() + CL.Count() - 3) * 10;
        ret = Math.Abs(A - a) + Math.Abs(B - b) + Math.Abs(C - c);
        return ret;
    }

    List<int> getList(int[] sw, int[] L ,int num)
    {
        List<int> ret = new List<int>();

        for(var i = 0;i < sw.Length;i++)
        {
            if(sw[i] == num)
            {
                ret.Add(L[i]);
            }
        }
        return ret;
    }


    int[,] calcArrayLO(int w, int h, int wdiff, int hdiff, string[] S)
    {
        int[,] ret = new int[h, w];
        var c = '0';
        for(var i = 0;i < w; i++)
        {
            for(var j = 0;j < h; j++)
            {
                c = S[j + hdiff + 1][i + wdiff + 1];
                if(c == '#')
                {
                    ret[j, i] = 1;
                }
                else
                {
                    ret[j, i] = ret[j + hdiff, i + wdiff] + 1;
                }
                    
            }
        }

        return ret;
    }

    int[,] calcArrayRU(int w, int h, int wdiff, int hdiff, string[] S)
    {
        int[,] ret = new int[h, w];
        var c = '0';
        for (var i = w-1; 0 <= i; i--)
        {
            for (var j = h-1;0 <= j; j--)
            {
                c = S[j + hdiff + 1][i + wdiff + 1];
                if (c == '#')
                {
                    ret[j, i] = 1;
                }
                else
                {
                    ret[j, i] = ret[j + hdiff, i + wdiff] + 1;
                }

            }
        }

        return ret;
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}
