{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cimg src\u003d\"https://www.spoj.pl/content/spookycookie:yoda\" style\u003d\"float:left\" /\u003eYoda is the wisest, and perhaps the most powerful Jedi of his time. Yoda is a mysterious figure and he has many oddities. One of them is that Yoda often changes the order of words in the sentence. For example, one of such phrases is \u0026quot;Or I will help you not.\u0026quot; Let\u0026#39;s call the \u003cspan data-scayt_word\u003d\"yodaness\" data-scaytid\u003d\"1\"\u003eyodaness\u003c/span\u003e level of any statement the number of pairs of words that changed their order, as to the order in which they were supposed to go in a normal statement. Write a program that determines the \u003cspan data-scayt_word\u003d\"yodaness\" data-scaytid\u003d\"2\"\u003eyodaness\u003c/span\u003e level of different statement of Yoda.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThe first line of input contains the number t - the number of tests. Next comes the description of t tests. Each test consists of three rows. The first line of the test contains an integer n - number of words in the statement. The next line contains n words separated by spaces - the statement as Yoda says it. The next line is n words separated by spaces - the same statement as it should be said normally. All the words in the statement are different and consist of small \u003cspan data-scayt_word\u003d\"latin\" data-scaytid\u003d\"13\"\u003elatin\u003c/span\u003e letters.\u003c/p\u003e\r\n\u003ch3\u003e\r\n\tConstraints\u003c/h3\u003e\r\n\u003cp\u003e\r\n\t1 \u0026lt;\u003d t \u0026lt;\u003d 10\u003cbr /\u003e\r\n\t1 \u0026lt;\u003d n \u0026lt;\u003d 30000\u003cbr /\u003e\r\n\tthe length of each word does not exceed 20 characters\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tFor each test print the \u003cspan data-scayt_word\u003d\"yodaness\" data-scaytid\u003d\"3\"\u003eyodaness\u003c/span\u003e level of the statement.\u003c/p\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003cb\u003eInput:\u003c/b\u003e\r\n2\r\n6\r\nin the force strong you are\r\nyou are strong in the force\r\n6\r\nor i will help you not\r\nor i will not help you\r\n\r\n\u003cb\u003eOutput:\u003c/b\u003e\r\n11\r\n2\r\n\r\n\u003c/pre\u003e"}}]}