{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"## 题目描述\n\n给你一个包含 $n$ 个整数的数组,每个元素 $a_i$ 都是以下六个数字之一:$4, 8, 15, 16, 23, 42$。\n\n请你求出最少移除多少元素,使得剩下的数组是**优秀的**。\n\n一个长度为 $k$ 的数组是**优秀的**,当且仅当,$k$ 被 $6$ 整除,并且能把数组分为 $\\frac{k}{6}$ 个 $4, 8, 15, 16, 23, 42$ 这样的子序列。\n\n例如,以下数组是优秀的:\n\n* $[4, 8, 15, 16, 23, 42]$(整个数组就是要求的子序列);\n* $[4, 8, 4, 15, 16, 8, 23, 15, 16, 42, 23, 42]$(第一个子序列是数组中第一、二、四、五、七、十个元素构成的,第二个子序列是剩下的元素构成的);\n* $[]$(空数组也是优秀的)。\n\n以下数组不是优秀的:\n\n* $[4, 8, 15, 16, 42, 23]$(子序列的顺序必须为 $4, 8, 15, 16, 23, 42$);\n* $[4, 8, 15, 16, 23, 42, 4]$(数组长度不能被 $6$ 整除);\n* $[4, 8, 15, 16, 23, 42, 4, 8, 15, 16, 23, 23]$(前六个元素可以构成要求的子序列,而剩下的元素不能构成)。\n\n## 输入格式\n\n第一行包含一个整数 $n$($1 \\le n \\le 5 \\cdot 10^5$),表示数组长度。\n\n第二行包含 $n$ 个整数 $a_1, a_2, \\dots, a_n$,每个元素 $a_i$ 都是以下六个数字之一:$4, 8, 15, 16, 23, 42$。\n\n## 输出格式\n\n输出一个整数,表示移除元素的最少数量,使得剩下的数组是**优秀的**。"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n4 8 15 16 23\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e12\n4 8 4 15 16 8 23 15 16 42 23 42\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 3","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e15\n4 8 4 8 15 16 8 16 23 15 16 4 42 23 42\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}