There are $n$ students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name starts with the same letter will be chatty if they are put in the same classroom (because they must have a lot in common). Let $x$ be the number of such pairs of students in a split. Pairs $(a, b)$ and $(b, a)$ are the same and counted only once.

For example, if there are $6$ students: "olivia", "jacob", "tanya", "jack", "oliver" and "jessica", then:  splitting into two classrooms ("jack", "jacob", "jessica", "tanya") and ("olivia", "oliver") will give $x=4$ ($3$ chatting pairs in the first classroom, $1$ chatting pair in the second classroom),  splitting into two classrooms ("jack", "tanya", "olivia") and ("jessica", "oliver", "jacob") will give $x=1$ ($0$ chatting pairs in the first classroom, $1$ chatting pair in the second classroom). 

You are given the list of the $n$ names. What is the minimum $x$ we can obtain by splitting the students into classrooms?

Note that it is valid to place all of the students in one of the classrooms, leaving the other one empty.


-----Input-----

The first line contains a single integer $n$ ($1\leq n \leq 100$) — the number of students.

After this $n$ lines follow.

The $i$-th line contains the name of the $i$-th student.

It is guaranteed each name is a string of lowercase English letters of length at most $20$. Note that multiple students may share the same name.


-----Output-----

The output must consist of a single integer $x$ — the minimum possible number of chatty pairs.


-----Examples-----
Input
4
jorge
jose
oscar
jerry

Output
1

Input
7
kambei
gorobei
shichiroji
kyuzo
heihachi
katsushiro
kikuchiyo

Output
2

Input
5
mike
mike
mike
mike
mike

Output
4



-----Note-----

In the first sample the minimum number of pairs is $1$. This can be achieved, for example, by putting everyone except jose in one classroom, and jose in the other, so jorge and jerry form the only chatty pair.

In the second sample the minimum number of pairs is $2$. This can be achieved, for example, by putting kambei, gorobei, shichiroji and kyuzo in one room and putting heihachi, katsushiro and kikuchiyo in the other room. In this case the two pairs are kambei and kyuzo, and katsushiro and kikuchiyo.

In the third sample the minimum number of pairs is $4$. This can be achieved by placing three of the students named mike in one classroom and the other two students in another classroom. Thus there will be three chatty pairs in one classroom and one chatty pair in the other classroom.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = [0] * 27
for i in range(n):
	s = input()
	a[ord(s[0]) - ord('a')] += 1
ans = 0
for i in range(26):
	t = a[i] // 2
	k = a[i] - t
	ans += t * (t - 1) // 2
	ans += k * (k - 1) // 2
print(ans)


from collections import defaultdict

n = int(input())
x = defaultdict(int)
for i in range(n):
    s = input()
    x[s[0]] += 1

sol = 0
for i in x:
    a = x[i] // 2
    b = x[i] - a
    sol += a * (a-1) // 2
    sol += b * (b-1) // 2
print(sol)

def main():
    arr = [0] * 26
    for i in range(int(input())):
        s = input()
        s = ord(s[0]) - ord('a')
        arr[s] += 1
    ans = 0
    for i in range(26):
        a = arr[i] // 2
        b = arr[i] - a
        ans += a * (a - 1)
        ans += b * (b - 1)
    print(ans >> 1)
    return 0

main()

from sys import *
from math import *
from collections import *


M = {}

n = int(input())

for i in range(n):
    s = input()
    if s[0] not in M:
        M[s[0]] = 1
    else:
        M[s[0]] += 1

ans = 0

for m in M:
    if M[m] > 2:
        l = M[m] // 2
        r = M[m] - l
        if l >= 2:
            ans += l * (l - 1) // 2
        if r >= 2:
            ans += r * (r - 1) // 2
print(ans)        

import string

names = {c: 0 for c in string.ascii_lowercase}

for _ in range(int(input())):
	names[input()[0]] += 1

c = 0

f = lambda n: n * (n - 1) // 2

for k in names:
	c += f(names[k] // 2) + f(-(-names[k] // 2))

print(c)

n = int(input())
from collections import defaultdict
c = defaultdict(int)
for _ in range(n):
    name = input()
    c[name[0]]+=1
total = 0
for k,v in c.items():
    left = v//2
    right = (v+1)//2
    total += (left*(left-1))//2
    total +=(right*(right-1))//2
print (total)

n = int(input())
a = [0 for _ in range(26)]

for _ in range(n):
	name = input()
	a[ord(name[0]) - ord('a')] += 1

t = 0
for m in a:
	l1 = m // 2
	l2 = m - l1

	t += l1 * (l1 - 1) // 2
	t += l2 * (l2 - 1) // 2
print(t)

n = int(input())
s = [input() for i in range(n)]

ans = 0
for c_i in range(26):
    c = chr(ord('a') + c_i)
    cnt = sum(1 for name in s if name.startswith(c))
    a = cnt // 2
    b = cnt - a
    ans += (a * (a - 1)) // 2
    ans += (b * (b - 1)) // 2
print(ans)


n = int(input())
a = []
for _ in range(n):
    a.append(input()[0])
q = 0
def f(x):
    return x * (x - 1) // 2

for i in set(a):
    r = a.count(i)
    if r % 2 == 0:
        q += 2 * f(r // 2)
    else:
        q += f(r // 2) + f(r // 2 + 1)
print(q)


n = int(input())

names = dict()

for _ in range(n):
    name = input().strip()
    if name[0] not in names:
        names[name[0]] = 0
    names[name[0]] += 1

cnt = 0
for k,v in names.items():
    prvi = v//2
    drugi = v - prvi
    cnt += (prvi*(prvi - 1))//2
    cnt += (drugi*(drugi - 1))//2
print(cnt)

n = int(input())
s = {}
for i in range(n):
    q = input()
    if q[0] in list(s.keys()):
        s[q[0]] += 1
    else:
        s[q[0]] = 1
u = []
ans = 0
for i in list(s.keys()):
    k = s[i]
    u.append(k)
    a = k // 2; b = k - a
    ans += (a - 1) * a // 2 + (b - 1) * b // 2
print(ans)


n = int(input())
x = {}
for i in range(n):
    l = input()
    try:
        x[l[0]].append(l)
    except:
        x[l[0]] = [l]

p = 0

for (k, v) in x.items():
    a = len(v) // 2
    b = len(v) - a
    p += (a-1) * a / 2
    p += (b-1) * b / 2

print(int(p))

from collections import defaultdict

def pairs(n):
    return n * (n - 1) // 2

n = int(input())
names = [input() for _ in range(n)]
letters = defaultdict(int)
for name in names:
    letters[name[0]] += 1

ans = 0
for val in letters.values():
    ans += pairs(val // 2) + pairs(val - val // 2)
print(ans)

from collections import Counter

n = int(input())
counts = Counter()
for _ in range(n):
    name = input()
    counts[name[0]] += 1

ans = 0
for letter, count in counts.items():
    a = count // 2
    b = count - a
    ans += a * (a - 1) // 2
    ans += b * (b - 1) // 2

print(ans)

n=int(input())
l1=[0]*26
for i in range(n):
    s=input()
    l1[ord(s[0])-97]+=1
ans=0
for item in l1:
    x=item//2
    y=item-x
    ans+=x*(x-1)//2
    ans+=y*(y-1)//2
print(ans)

n = int(input())
d = {}
for _ in range(n):
    c = input()[0]
    d[c] = d.get(c, 0) + 1
res = 0
# print(d)
for v in d.values():
    x = (v + 1) // 2
    res += (x * (x - 1)) // 2
    y = v - x
    res += (y * (y - 1)) // 2
print(res)

n = int(input())
l = [0] * 26
for _ in range(n):
	s = input()
	l[ord(s[0]) - 97] += 1
ans = 0
for i in range(26):
	x = l[i] // 2
	y = l[i] - x
	ans += x * (x - 1) // 2
	ans += y * (y - 1) // 2
print(ans)

import sys
input = sys.stdin.readline

n=int(input())
l=[0]*26
for i in range(n):
	s=input()
	l[ord(s[0])-97]+=1

ans=0
for i in range(26):
	cur=l[i]//2
	nex=l[i]-cur
	ans+=cur*(cur-1)//2
	ans+=nex*(nex-1)//2

print(ans)


n = int(input())
sp = [0] * 26
for i in range(n):
	st = input()
	sp[ord(st[0]) - ord("a")] += 1
sm = 0
for x in sp:
	ch = x // 2
	sm += ch * (ch - 1) // 2
	sm += (x - ch) * (x - ch - 1) // 2
print(sm)


n=int(input())
dict1={}
for i in range(n):
    s=str(input())
    try:
        dict1[s[0]]+=1
    except:
        KeyError
        dict1[s[0]]=1
ans=0
for i in list(dict1.keys()):
    if(dict1[i]>2):
        val1=dict1[i]//2
        val2=dict1[i]//2+dict1[i]%2
        if(val1>0):
            ans+=(val1*(val1-1))//2
        if(val2>0):
            ans+=(val2*(val2-1))//2
print(ans)


n=int(input())
counter=0
dic={}
for i in range(n):
    a=list(input())
    if a[0] not in dic:
        dic[a[0]]=1
    else:
        dic[a[0]]+=1
for item in dic:
    y=dic[item]
    x=dic[item]//2
    counter+=x*(x-1)//2+(y-x)*(y-x-1)//2
print(counter)


#Bhargey Mehta (Sophomore)
#DA-IICT, Gandhinagar
import sys, math, queue
#sys.stdin = open("input.txt", "r")
MOD = 10**9+7

n = int(input())
d = {}
for i in range(n):
    s = input()
    if s[0] in d:
        d[s[0]] += 1
    else:
        d[s[0]] = 1

ans = 0
for k in d:
    x1 = (d[k]+1)//2
    x2 = d[k]-x1
    ans += (x1*(x1-1))//2 + (x2*(x2-1))//2
print(ans)

n = int(input())

D = {}

for _ in range(n):
    x = input()[:1]
    if x in D:
        D[x] += 1
    else:
        D[x] = 1
    
T = 0
for i in D:
    m = 10000000
    for j in range(D[i]):
        m = min(m,(j*(j-1))//2+((D[i]-j)*(D[i]-j-1))//2)
    T += m
    
print(T)