/* -*- coding: utf-8 -*- * * 2737.cc: No.2737 Compound Word - yukicoder */ #include #include #include using namespace std; /* constant */ const int MAX_N = 50; const int MAX_L = 100; /* typedef */ /* global variables */ string ss[MAX_N], ts[MAX_N * MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { char s[MAX_L + 4]; scanf("%s", s); ss[i] = string(s); } int m = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (i != j) ts[m++] = ss[i] + ss[j]; sort(ts, ts + m); m = unique(ts, ts + m) - ts; printf("%d\n", m); return 0; }