#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int f[20][55][25][20][15];
int p[5] = { 0, 4, 6, 8, 5 };
int total = 19;
struct Res
{
int a, b, c, d;
}res[15];
int main()
{
int cnt = 1;
for (int i = total / p[1]; i >= 0; i--)
{
for (int j = total / p[2]; j >= 0; j--)
{
for (int k = total / p[3]; k >= 0; k--)
{
for (int l = total / p[4]; l >= 0; l--)
{
int sum = i * p[1] + j * p[2] + k * p[3] + l * p[4];
if (sum <= total)
{
if (total - sum < 4)
{
res[cnt].a = i;
res[cnt].b = j;
res[cnt].c = k;
res[cnt].d = l;
cnt++;
}
}
}
}
}
}
//cout << cnt << endl;
memset(f, 0x3f, sizeof f); // 初始化
for (int i = 1; i < cnt; i++)
{
for (int j = 1; j < cnt; j++)
{
f[i][res[j].a][res[j].b][res[j].c][res[j].d] = 1;
cout << i << " " << res[j].a << " " << res[j].b << " " << res[j].c << " " << res[j].d << endl;
}
}
int ans = 1e9;
for (int x1 = 1; x1 < cnt; x1++)
{
for (int x2 = x1 + 1; x2 < cnt; x2++)
{
for (int x3 = x2 + 1; x3 <= cnt; x3++)
{
for (int i = 0; i <= 50; i++)
{
for (int j = 0; j <= 20; j++)
{
for (int k = 0; k <= 15; k++)
{
for (int l = 0; l <= 10; l++)
{
int& t = f[x1][i][j][k][l];
t = min({ t,
f[x1][i - res[x1].a][j - res[x1].b][k - res[x1].c][l - res[x1].d] + 1,
f[x2][i - res[x2].a][j - res[x2].b][k - res[x2].c][l - res[x2].d] + 1,
f[x3][i - res[x3].a][j - res[x3].b][k - res[x3].c][l - res[x3].d] + 1 });
}
}
}
}
ans = min(ans, f[x1][50][20][15][10]);
}
}
}
cout << ans << endl;
return 0;
}