module main; import std; void chMin(T)(ref T a, in T b) { if (a > b) a = b; } void main() { immutable INF = int.max / 3; auto V = readln.split.to!(int[]); V.sort; int ans = INF; foreach (A; 1 .. 29) { foreach (B; A + 1 .. 30) { LOOP: foreach (C; B + 1 .. 31) { int cnt = 0; foreach (v; V) { auto dp = new int[](31); dp[] = INF; dp[0] = 0; foreach (i; 1 .. v + 1) { if (i - A >= 0 && dp[i - A] != INF) chMin(dp[i], dp[i - A] + 1); if (i - B >= 0 && dp[i - B] != INF) chMin(dp[i], dp[i - B] + 1); if (i - C >= 0 && dp[i - C] != INF) chMin(dp[i], dp[i - C] + 1); } if (dp[v] == INF) continue LOOP; cnt += dp[v]; } chMin(ans, cnt); } } } writeln(ans); }