import java.io.*;
import java.util.StringTokenizer;

public class relatives_ak {

    int set(int i, int mask) {
        return mask | (1 << i);
    }

    int aToMask(String s) {
        int res = 0;
        for (char c : s.toCharArray()) {
            res = set(c - '0', res);
        }
        return res;
    }


    void solve() throws IOException {
        int n = in.nextInt();
        long[] count = new long[1 << 10];
        for (int i = 0; i < n; i++) {
            count[aToMask(in.next())]++;
        }
        long ans = 0;
        for (int i = 0; i < count.length; i++) {
            for (int j = i + 1; j < count.length; j++) {
                if ((i & j) != 0) {
                    ans += count[i] * count[j];
                }
            }
            ans += count[i] * (count[i] - 1) / 2;
        }
        out.println(ans);
    }

    static MyScanner in;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        in = new MyScanner(new FileReader("relatives.in"));
        out = new PrintWriter("relatives.out");
        new relatives_ak().solve();
        out.close();
    }

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        MyScanner(Reader r) {
            this.br = new BufferedReader(r);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
    }
}
