#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream &operator<<(ostream &os, const T_container &v) {
  os << '{';
  string sep;
  for (const T &x : v) os << sep << x, sep = ", ";
  os << '}';
  return os;
}
template <typename T>
void debug_vars(string s, T t) {
  cerr << "[" << s << ": " << t << "]\n";
}
template <typename T, typename... U>
void debug_vars(string s, T t, U... u) {
  long long w = 0, c = 0;
  while (w < (long long)s.size()) {
    if (s[w] == '(') c++;
    if (s[w] == ')') c--;
    if (!c and s[w] == ',') break;
    w++;
  }
  cerr << "[" << s.substr(0, w) << ": " << t << "] ";
  debug_vars(s.substr(w + 2, (long long)s.size() - w - 1), u...);
}
long long get_match(string &small, string &large, long long large_pos) {
  long long match_pos = large_pos, small_pos = 0;
  while (match_pos < (long long)large.size() &&
         small_pos < (long long)small.size()) {
    if (small[small_pos] == large[match_pos]) {
      match_pos++;
    }
    small_pos++;
  }
  return match_pos - large_pos;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<string> m;
  for (long long i = 0; i < n; i++) {
    string x;
    cin >> x;
    m.push_back(x);
  }
  string s;
  cin >> s;
  long long pos = 0, ans = 0;
  while (pos < (long long)s.size()) {
    long long max_match = 0;
    for (auto &k : m) max_match = max(max_match, get_match(k, s, pos));
    if (max_match == 0) {
      cout << "-1\n";
      return 0;
    }
    pos += max_match;
    ans++;
  }
  cout << ans << "\n";
}
