Birthday Cake
题号:NC221779
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Moca's birthday is coming up, and her friend Ran is going to the Yamabuki bakery to order a birthday cake for her.

Yamabuki bakery provides kinds of cake. Since Ran knows that Moca is the Yamabuki Bakery's -st fan and can eat a lot of food, she intends to order two cakes and put them together into a big cake. The cake made by Yamabuki bakery can be formed by a string consisting of lowercase Latin letters, which describes the toppings on the cake, such as strawberries and chocolate. Putting two cakes together is the concatenation of two corresponding strings. For example, the result of putting cake and cake together is a big cake .

To make it easier to share the cake, Ran will choose two cakes and put them together into a big cake which can be divided in half into two identical pieces. For example, cake  will be divided in half into two cakes , but cake  will be divided in half into two different cakes  and . Notice that Ran can not reverse the cake, which means that cake  will be divided into two different cakes  and .

Can you help Ran figure out how many different pairs of cakes meet the above condition?

输入描述:

The first line contains one integer   -- the number of cakes.

The next lines describe all the cakes, where the -th line contains one string s_i  consisting of lowercase Latin letters.

It is guaranteed that the sum of lengths of cakes does not exceed .

输出描述:

Print one integer -- the number of pairs of cakes meet the above condition.
示例1

输入

复制
3
ab
ab
cabc

输出

复制
3
示例2

输入

复制
3
abc
a
cabc

输出

复制
0
示例3

输入

复制
4
hhh
hhh
hhh
hhh

输出

复制
6