#include #include int main() { int N; scanf("%d", &N); char strings[N][101]; // Array to store the strings for (int i = 0; i < N; i++) { scanf("%s", strings[i]); } int count = 0; // Variable to count the number of distinct concatenated strings // Iterate over each pair of strings and check if the concatenated string is distinct for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (i != j) { char concatenated[201]; // Array to store the concatenated string strcpy(concatenated, strings[i]); strcat(concatenated, strings[j]); // Check if the concatenated string is distinct from all previously formed strings int distinct = 1; for (int k = 0; k < N; k++) { if (k != i && k != j && strcmp(concatenated, strings[k]) == 0) { distinct = 0; break; } } // If the concatenated string is distinct, increment the count if (distinct) { count++; } } } } printf("%d\n", count); return 0; }