{"task": {"agent_timeout": 600, "task": "892", "verifier_timeout": 7200, "instruction": "Please implement a Python 3 solution to the below problem.\nReason through the problem and:\n1. Restate the problem in plain English\n2. Conceptualize a solution first in plain English\n3. Write a pseudocode solution\n4. Save your solution as solution.py\nNo outside libraries are allowed.\n\n[BEGIN PROBLEM]\nFarmer John is attempting to sort his $N$ cows ($1 \\leq N \\leq 100$),\nconveniently numbered $1 \\dots N$, before they head out to the pastures for\nbreakfast.\n\nCurrently, the cows are standing in a line in the order\n$p_1, p_2, p_3,\n\\dots, p_N$, and Farmer John is standing in front of cow $p_1$.\nHe wants to reorder the cows so that they are in the order $1, 2, 3, \\dots, N$,\nwith cow $1$ next to Farmer John.\n\nThe cows are a bit sleepy today, so at any point in time the only cow who is\npaying attention to Farmer John's instructions is the cow directly facing Farmer\nJohn. In one time step, he can instruct this cow to move $k$ paces down the\nline, for any $k$ in the range $1 \\ldots N-1$. The $k$ cows whom she passes will\namble forward, making room for her to insert herself in the line after them.\n\nFor example, suppose that $N=4$ and the cows start off in the following order:\n\n FJ: 4, 3, 2, 1 \nThe only cow paying attention to FJ is cow $4$. If he instructs her to move $2$\npaces down the line, the order will subsequently look like this:\n\n FJ: 3, 2, 4, 1 \nNow the only cow paying attention to FJ is cow $3$, so in the second time step\nhe may give cow $3$ an instruction, and so forth until the cows are sorted.\n\nFarmer John is eager to complete the sorting, so he can go back to the farmhouse\nfor his own breakfast. Help him find the minimum number of time steps required\nto sort the cows.\n\nINPUT FORMAT:\nThe first line of input contains $N$.  \n\nThe second line contains $N$ space-separated integers, \n$p_1, p_2, p_3, \\dots, p_N$, indicating the starting order of the cows.\n\n\nOUTPUT FORMAT:\nA single integer: the number of time steps before the $N$ cows are in sorted\norder, if Farmer John acts optimally.\n\nSAMPLE INPUT:\n4\n1 2 4 3\nSAMPLE OUTPUT: \n3\n\n\nProblem credits: Dhruv Rohatgi\n\n[END PROBLEM]\n", "memory": "2048m", "runnable": false, "difficulty": "medium", "language": "", "cpus": 1, "instruction_truncated": false, "category": "python_programming", "compose": false, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "usaco", "tags": ["python", "programming", "usaco"]}, "runs": []}