All Tracks Algorithms String Algorithms Problem

Hungry OWL and Foolish EAGLE (Easy)
Tag(s):

Very-Easy

Problem
Editorial
Analytics

In a magical forest, EAGLE went to OWL for classes. OWL taught EAGLE N stories with chapter numbers 1 to N. At the end of the day, OWL used to ask EAGLE to repeat all the Chapter Numbers with its Story Name.

OWL is a nice teacher, so didn't care of the order of the chapters told by EAGLE.
Also OWL is always hungry and need to rush for lunch so, OWL counts a chapter correct, even if the Story Name for a corresponding chapter number is jumbled.
But, if a Story Name (same or jumbled) gets mixed with another Chapter Number, it is said to be wrong.

After EAGLE completes writing all the chapters, You need to calculate number of mistakes committed by him.

Standard Input:
Each input contains 2*N + 1 lines. First line contains N, representing number of chapters.
Next N Lines contains chapters taught by OWL by a integer X and a string S.
X -> Chapter number
S -> Chapter Name

Next N lines contains the answer written by EAGLE containg integer X and string S.
X-> Chapter number.
S-> Chapter Name.


Standard Output:
Print a single integer denoting number of mistakes done by EAGLE.

Constraints:
1<=n<=100
1<=Length of story name (consisting of small character only (a-z) ) <=100

SAMPLE INPUT
2
1 sameer
2 ayush
2 shauy
1 aeemss
SAMPLE OUTPUT
1
Explanation

In first N+1 lines Owl taught two chapters with correspoding Story Name. Next,
In first line, Eagle wrote chapter
2 shauy
which is chapter 2 corresponding to its name "ayush" (as jumbled), which is correct
In second line, Eagle wrote chapter
1 eermss
which is chapter 1 corresponding to "sameer",
SInce it can't be rearranged to correct Story name, it is Incorect. So answer is 1 .

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), TypeScript, Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications

?