#include <bits/stdc++.h>
using namespace std;
int N, A, B, C;
int abc[3];
int MP = INT_MAX;
int MAX_DEPTH;
void search(int l[], int used[], int index, int mp, int length, int prev) {
  if (mp > MP) return;
  if (abs(prev - abc[index]) < abs(length - abc[index])) return;
  if (index == 3) {
    MP = min(mp, MP);
    return;
  }
  if (abc[index] == length) {
    search(l, used, index + 1, mp, 0, INT_MAX);
    return;
  }
  if (length == 0) {
    for (int i = 0; i < N; i++) {
      if (used[i] == 0) {
        used[i] = 1;
        search(l, used, index, mp, l[i], INT_MAX);
        used[i] = 0;
      }
    }
  } else {
    search(l, used, index, mp + 1, length + 1, length);
    if (length >= 2) {
      search(l, used, index, mp + 1, length - 1, length);
    }
    for (int i = 0; i < N; i++) {
      if (used[i] == 0) {
        used[i] = 1;
        search(l, used, index, mp + 10, length + l[i], length);
        used[i] = 0;
      }
    }
  }
  return;
}
int main() {
  cin >> N >> A >> B >> C;
  abc[0] = A;
  abc[1] = B;
  abc[2] = C;
  int l[N];
  int used[N];
  int near[3];
  MAX_DEPTH = N;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
    used[i] = 0;
  }
  search(l, used, 0, 0, 0, INT_MAX);
  cout << MP << endl;
  return 0;
}
