#include <bits/stdc++.h>
using namespace std;
int MAX = numeric_limits<int>().max() / 16;
vector<vector<int>> cost;
int make(vector<int> &l, int target) {
  int s = 0;
  for (auto &ll : l) {
    s += ll;
  }
  return l.size() + abs(target - s);
}
int main() {
  cost.resize(3);
  cost[0].resize(256, MAX);
  cost[1].resize(256, MAX);
  cost[2].resize(256, MAX);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for (int i = 0; i < N; ++i) {
    cin >> l[i];
  }
  int b = 1 << N;
  for (int i = 0; i < b; ++i) {
    vector<int> ll;
    for (int j = 1; j < b; b <<= 1) {
      if (i & j == 0) {
        continue;
      }
      ll.emplace_back(l[i]);
    }
    cost[0][i] = make(ll, A);
    cost[1][i] = make(ll, B);
    cost[2][i] = make(ll, C);
  }
  int ans = MAX;
  int tmp = 0;
  for (int i = 0; i < 65536; ++i) {
    int a = (i & ((1 << 8) - 1));
    int b = (i & ((1 << 16) - 1)) >> 8;
    int c = (i & ((1 << 24) - 1)) >> 16;
    if (a & b) {
      continue;
    }
    if (a & c) {
      continue;
    }
    if (b & c) {
      continue;
    }
    if (((a | b | c) & (255 << (N - 2)))) {
      continue;
    }
    tmp = cost[0][a] + cost[1][b] + cost[2][c];
    if (tmp < ans) {
      ans = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}
