407201: GYM102697 172 Snowball Fight

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

172. Snowball Fighttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You're tired of the warm July weather, so you and your friends decide to take a trip to Antarctica, and have a snowball fight.

Each person is given a very large number of snowballs (essentially, an infinite number). Each person is also wearing a coat with a certain color, and boots with a certain color.

Throughout the snowball fight, each person throws their snowballs at everyone else who doesn't either have the same color of coat, or the same color of boots, exactly once. Obviously, people don't throw snowballs at themselves.

Given this information, figure out how many snowballs are thrown in total during the snowball fight.

Input

The first line of input consists of a single positive integer $$$n$$$: the number of people involved in the snowball fight.

The next line of input consists of $$$n$$$ space-separated strings: the coat color of each person involved in the snowball fight, in order.

The next line of input consists of $$$n$$$ space-separated strings: the boot color of each person involved in the snowball fight, in order.

Output

Output a single positive integer $$$n$$$: the total number of snowballs that are thrown during the snowball fight.

ExamplesInput
5
red red green green blue
red blue yellow green green
Output
14
Input
5
red red green yellow purple
brown blue maroon pink orange
Output
18

加入题单

上一题 下一题 算法标签: