#include #include #include #include using namespace std; int main() { int n; cin >> n; unordered_map map; string len; for (int i = 0; i < n; i++) { cin >> len; map[len]++; } const int r = 3; long long divided = 1; int divisor = 1; int not_overlap_count = map.size(); for (int i = 0; i < r; i++) { divided *= not_overlap_count - i; divisor *= r - i; } long long pattern = divided / divisor; for (auto keyValue : map) { pattern *= keyValue.second; } long long res; if (numeric_limits::max() < pattern) { res = pattern % (1000000000 + 7); } else { res = pattern; } cout << res << endl; return 0; }