cin >> n; int M = (1 << n) - 1, ch[26]; for (int i = 1; i <= n; ++i) { cin >> s + 1; int l = strlen(s + 1); for (int j = 1; j <= l; ++j) ++num[i][s[j] - 'a']; } for (int S = 1; S <= M; ++S) { int cnt = 0; for (int i = 0; i < 26; ++i) ch[i] = INF; for (int i = 1; i <= n; ++i) { if (!(S >> i - 1 & 1)) continue; g[S] += i; ++cnt; for (int c = 0; c < 26; ++c) ch[c] = min(ch[c], num[i][c]); } f[S][cnt & 1] = 1; g[S] *= cnt; for (int i = 0; i < 26; ++i) if (ch[i] != INF) f[S][cnt & 1] = 1ll * f[S][cnt & 1] * (ch[i] + 1) % p; } for (int o = 0; o < n; ++o) for (int S = 0; S <= M; ++S) if (S >> o & 1) { f[S][0] = (f[S][0] + f[S ^ 1 << o][0]) % p; f[S][1] = (f[S][1] + f[S ^ 1 << o][1]) % p; } ll ans = 0; for (int S = 1; S <= M; ++S) ans ^= 1ll * g[S] * ((p + f[S][1] - f[S][0]) % p); cout << ans << "\n"; return0; }