Problem: Iahubina is tired of so many complicated languages, so she decided to invent a new, simple language. She already made a dictionary consisting of n 3-words. A 3-word is a sequence of exactly 3 lowercase letters of the first 24 letters of the English alphabet (a to x). She decided that some of the letters are vowels, and all the others are consonants. The whole language is based on a simple rule: any word that contains at least one vowel is correct.

Iahubina forgot which letters are the vowels, and wants to find some possible correct sets of vowels. She asks Iahub questions. In each question, she will give Iahub a set of letters considered vowels (in this question). For each question she wants to know how many words of the dictionary are correct, considering the given set of vowels.

Iahubina wants to know the xor of the squared answers to all the possible questions. There are 224 different questions, they are all subsets of the set of the first 24 letters of the English alphabet. Help Iahub find that number.

Input

The first line contains one integer, n (1 ≤ n ≤ 104). Each of the next n lines contains a 3-word consisting of 3 lowercase letters. There will be no two identical 3-words.

Output

Print one number, the xor of the squared answers to the queries.

Examples

Input

5
abc
aaa
ada
bcd
def


Output

0

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scan sc = new Scan();
        int n = sc.scanInt();
        Sol sol = new Sol(n);
        for(int i = 0; i < n; ++i){
            sol.arr[i] = sc.scanString();
        }
        sol.sol();
    }
}

class Sol {
    int mx;
    int[] cnt;
    String[] arr;
    HashSet<Integer> tset;
    
    Sol(int n) {
        this.mx = 1<<24;
        arr = new String[n];
        cnt = new int[mx];    
        tset = new HashSet<Integer>();
        
    }
    
    void sol(){
        for(int iter = 0, end = arr.length; iter < end; ++iter){
            char[] curr = arr[iter].toCharArray();
            tset.clear();
            for(int i = 1; i < 8; ++i){
                int val = 0;
                int count = 0;
                for(int k = 0; k < 3; ++k){
                    if((i&(1<<k)) != 0){
                        ++count;
                        val |= (1<<(curr[k] - 'a'));
                    }
                }
                if(!tset.contains(val)){
                    tset.add(val);
                    cnt[val] += ((count&1) == 0 ? -1 : 1);
                }
            }
        }
        
        for(int i = 0; i < 24; ++i){
            for(int msk = 1<<i; msk < mx; ++msk){
                if((msk & (1<<i)) != 0)
                    cnt[msk] += cnt[msk^(1<<i)];
            }
        }
        
        // abc
        // aaa
        // ada
        // bcd
        // def

        
        int res = 0;
        for(int i = 0; i < mx; ++i){
            //System.out.println(Integer.toBinaryString(i) + " --> " + cnt[i]);
            res ^= (cnt[i]*cnt[i]);
        }
        System.out.println(res);
    }
}

class Scan {
    private byte[] buf=new byte[1024];
    private int index;
    private InputStream in;
    private int total;
    public Scan()
    {
        in=System.in;
    }
    public int scan()throws IOException
    {
        if(total<0)
        throw new InputMismatchException();
        if(index>=total)
        {
            index=0;
            total=in.read(buf);
            if(total<=0)
            return -1;
        }
        return buf[index++];
    }
    public int scanInt()throws IOException
    {
        int integer=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n))
        {
            if(n>='0'&&n<='9')
            {
                integer*=10;
                integer+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }
    public double scanDouble()throws IOException
    {
        double doub=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n)&&n!='.')
        {
            if(n>='0'&&n<='9')
            {
                doub*=10;
                doub+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        if(n=='.')
        {
            n=scan();
            double temp=1;
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n=scan();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }
    public String scanString()throws IOException
    {
        StringBuilder sb=new StringBuilder();
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        while(!isWhiteSpace(n))
        {
            sb.append((char)n);
            n=scan();
        }
        return sb.toString();
    }
    private boolean isWhiteSpace(int n)
    {
        if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
        return true;
        return false;
    }
}