#include <bits/stdc++.h>
using namespace std;
int n, m;
char sets[55][55];
char s[55 * 55];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%s", sets[i]);
  scanf("%s", s);
  m = strlen(s);
  int cmax = 0;
  int used = 0;
  while (cmax < m) {
    used++;
    int nextmax = cmax;
    for (int i = 0; i < n; i++) {
      int curr = cmax;
      for (int j = 0; j < strlen(sets[i]); j++)
        if (curr < m && s[curr] == sets[i][j]) curr++;
      nextmax = max(nextmax, curr);
    }
    if (nextmax == m) {
      cmax = nextmax;
      break;
    }
    if (nextmax == cmax) break;
    cmax = nextmax;
  }
  if (cmax < m) {
    printf("-1\n");
  } else {
    printf("%d\n", used);
  }
}
