#include<stdio.h>
#include<stdlib.h>
int comp( const void * p, const void *q)
{
return (*(int *)p - *(int *)q);
}
int main(void)
{
int T,age,count=-1;
scanf("%d",&T);
while(T--)
{
scanf("%d",&age);
if(age-7<8)
printf("%d\n",count);
else
printf("%d\n",age-7);
count=-1;
}
return 0;
}