import java.util.*; import java.io.*; import java.text.*; //Solution Credits: Taranpreet Singh public class Main{ //SOLUTION BEGIN void solve(int TC) throws Exception{ int n = ni(); HashMap map = new HashMap<>(); int ans = 0; for(int t = 0; t< n; t++){ String s = n(); if(map.containsKey(s))ans+= map.get(s); else{ int c = 2;boolean left = s.charAt(0)=='d' || s.charAt(0)=='f'; for(int i = 1; i