#include <bits/stdc++.h>
using namespace std;
int abs(int n) {
  if (n < 0) n = -n;
  return n;
}
int judge(bool ok, int *l, int N, int ABC) {
  if (ok) return 0;
  int ans = 0;
  int min = 10000;
  int no = 0;
  for (int i = 0; i < N; i++) {
    if (abs(ABC - l[i]) < min) {
      min = abs(ABC - l[i]);
      no = i;
    }
  }
  if (min <= 10) {
    l[no] = -100000;
    ok = true;
    return min;
  }
  int ni, nj;
  ni = nj = 0;
  bool isfusion = false;
  int temp = 0;
  int *tempi;
  tempi = new int[N];
  for (int i = 0; i < N; i++) {
    tempi[i] = l[i];
  }
  int count = 1;
fusions:
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) continue;
      int tmp = l[i] + l[j];
      if (ABC == tmp) {
        l[i] = l[j] = -100000;
        ok = true;
        return count * 10;
      }
      if (abs(ABC - tmp) < min - 10) {
        min = abs(ABC - tmp);
        ni = i;
        nj = j;
        l[ni] += l[nj];
        l[nj] = -100000;
        isfusion = true;
      }
    }
  }
  if (temp != min) {
    count++;
    temp = min;
    goto fusions;
  }
  if (isfusion) {
    l[ni] = l[nj] = -100000;
    ok = true;
    return count * 10 + min;
  }
  l[no] = -100000;
  ok = true;
  return min;
}
int main() {
  int N, A, B, C;
  cin >> N;
  cin >> A >> B >> C;
  bool okA, okB, okC;
  okA = okB = okC = false;
  int *l;
  l = new int[N];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> l[i];
    if (l[i] == A) {
      okA = true;
      l[i] = -1000000;
      continue;
    }
    if (l[i] == B) {
      okB = true;
      l[i] = -1000000;
      continue;
    }
    if (l[i] == C) {
      okC = true;
      l[i] = -1000000;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) continue;
      int tmp = l[i] + l[j];
      if (A == tmp) {
        ans += 10;
        l[i] = l[j] = -100000;
        okA = true;
      }
      if (B == tmp) {
        ans += 10;
        l[i] = l[j] = -100000;
        okB = true;
      }
      if (C == tmp) {
        ans += 10;
        l[i] = l[j] = -100000;
        okC = true;
      }
    }
  }
  ans += judge(okA, l, N, A);
  ans += judge(okB, l, N, B);
  ans += judge(okC, l, N, C);
  cout << ans;
  return 0;
}
