제목 : https://codeforces.com/contest/1176/problem/C
아이디어 : 순서의 경우는 : \ (4,8,15,16,23,42 \) , 단지 몇 행이 숫자가 현재 사용할 수 있습니다,하는 개방형 의 번호를 사용할 수 전에 소비되고 사용할 수 그들의 수를 증가
#include<bits/stdc++.h>
using namespace std;
#define DEBUG cout<<"DEBUG"<<endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pii> vpii;
int res;
int vis[10];
int mp[50];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
//freopen("in.txt","r",stdin);
mp[4]=0,mp[8]=1,mp[15]=2,mp[16]=3,mp[23]=4,mp[42]=5;
int n;cin>>n;
int res=0;
for(int i=1;i<=n;i++)
{
int t;
cin>>t;
t=mp[t];
if(!t) vis[t]++;
else if(vis[t-1])
{
vis[t-1]--;
vis[t]++;
}
}
cout<<n-vis[5]*6;
return 0;
}