import java.util.InputMismatchException;
import java.util.Scanner;

public class SalesArray {

	   public static void main(String[] args)
	    {
	    	int SIZE =12;

	    	int [] salesArr = new int [SIZE];
	        try (Scanner input = new Scanner(System.in)) {

	        	int number;
	        	System.out.print("Enter the sales information for 12 consecutive days: ");
	        	
	    		for (int k=0; k < salesArr.length; k++)
	    		{
				    number = input.nextInt();
				    salesArr[k]= number;
	    		}
			
	    		int avgThreshold=0;
	    		
				System.out.println("Enter the average threshold sale: ");
				avgThreshold = input.nextInt();

				int length=0;
				int maxLength=0;
				int index=0;
				boolean exit=false;
				for (int i=0; i< salesArr.length; i++)
				{
					length=0;
					index=0;
					if (salesArr[i] > avgThreshold)
					{
						index =i+1;
						length++;
						exit=false;
						for (; index < salesArr.length && !exit; index++)
						{
							if (salesArr[index]> avgThreshold) length++;
							else
							{
								// exit from this loop
								exit = true;
							}
						}
					}
					
					if (maxLength < length) maxLength=length;
				}
				
				if (maxLength >= 3)
				System.out.println("The max length of the high-sale sequence days: "+ maxLength);
				else 
				System.out.println("There are no high-sale sequence days greater than or equal to 3");

	        }
	    
	    catch (InputMismatchException  e)
	    {
	    	System.out.println("Error reading input");
	    }
	    }
}
