potrebujem zistit casovu zlozitost tohto tu: dnes inak to nema cenu
int main()
{
int pole[6] = {0,0,0,0,0,0};
int n; int i; int x;
cin >> n;
for (i=1; i<=n; i++)
{
cin >> x;
if (x>6)
{
pole[5]+=x/6;
pole[(x%6)-1]+=1;
}
else
{
pole[x-1]+=1;
}
}
int pp=0;
if (pole[5]>0){pp+=pole[5]; pole[5]=0;}
if(pole[4]>pole[0]){pp+=pole[4]; pole[4]=0; pole[0]=0;}
if(pole[4]<pole[0]){pp+=pole[4]; pole[0]-=pole[4]; pole[4]=0;}
if(pole[4]==pole[0]){pp+=pole[4]; pole[4]=0; pole[0]=0;}
if(pole[3]>pole[1]){pp+=pole[3]; pole[3]=0; pole[1]=0;}
if(pole[3]<pole[1]){pp+=pole[3]; pole[1]-=pole[3]; pole[3]=0;}
if(pole[3]==pole[1]){pp+=pole[3]; pole[3]=0; pole[1]=0;}
if(pole[2]%2==0){pp+=(pole[2]/2); }
else {pole[2]-1; pp+=pole[2]/2; pole[2]=1;}
int a=0;
for(i=1; i<=6; i++)
{
a+=(pole[i-1]*i);
}
if((a<=6)&&(a!=0)){pp+=1;}
if(a>6){pp+=a/6; if(a%6>0){pp+=1;}}
cout<<pp;
cin.get(); cin.get();
return 0 ;
}