#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
unsigned char mask[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
void getBuckets(unsigned char *s, int *bkt, int n, int K, int cs, bool end) {
  int i, sum = 0;
  for (i = 0; i <= K; i++) bkt[i] = 0;
  for (i = 0; i < n; i++)
    bkt[(cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i])]++;
  for (i = 0; i <= K; i++) {
    sum += bkt[i];
    bkt[i] = end ? sum : sum - bkt[i];
  }
}
void induceSAl(unsigned char *t, int *SA, unsigned char *s, int *bkt, int n,
               int K, int cs, bool end) {
  int i, j;
  getBuckets(s, bkt, n, K, cs, end);
  for (i = 0; i < n; i++) {
    j = SA[i] - 1;
    if (j >= 0 && !((t[(j) / 8] & mask[(j) % 8]) ? 1 : 0))
      SA[bkt[(cs == sizeof(int) ? ((int *)s)[j] : ((unsigned char *)s)[j])]++] =
          j;
  }
}
void induceSAs(unsigned char *t, int *SA, unsigned char *s, int *bkt, int n,
               int K, int cs, bool end) {
  int i, j;
  getBuckets(s, bkt, n, K, cs, end);
  for (i = n - 1; i >= 0; i--) {
    j = SA[i] - 1;
    if (j >= 0 && ((t[(j) / 8] & mask[(j) % 8]) ? 1 : 0))
      SA[--bkt[(cs == sizeof(int) ? ((int *)s)[j] : ((unsigned char *)s)[j])]] =
          j;
  }
}
void SA_IS(unsigned char *s, int *SA, int n, int K, int cs) {
  int i, j;
  unsigned char *t = (unsigned char *)malloc(n / 8 + 1);
  t[(n - 2) / 8] = (0) ? (mask[(n - 2) % 8] | t[(n - 2) / 8])
                       : ((~mask[(n - 2) % 8]) & t[(n - 2) / 8]);
  t[(n - 1) / 8] = (1) ? (mask[(n - 1) % 8] | t[(n - 1) / 8])
                       : ((~mask[(n - 1) % 8]) & t[(n - 1) / 8]);
  for (i = n - 3; i >= 0; i--)
    t[(i) / 8] =
        (((cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i]) <
              (cs == sizeof(int) ? ((int *)s)[i + 1]
                                 : ((unsigned char *)s)[i + 1]) ||
          ((cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i]) ==
               (cs == sizeof(int) ? ((int *)s)[i + 1]
                                  : ((unsigned char *)s)[i + 1]) &&
           ((t[(i + 1) / 8] & mask[(i + 1) % 8]) ? 1 : 0) == 1))
             ? 1
             : 0)
            ? (mask[(i) % 8] | t[(i) / 8])
            : ((~mask[(i) % 8]) & t[(i) / 8]);
  int *bkt = (int *)malloc(sizeof(int) * (K + 1));
  getBuckets(s, bkt, n, K, cs, true);
  for (i = 0; i < n; i++) SA[i] = -1;
  for (i = 1; i < n; i++)
    if ((i > 0 && ((t[(i) / 8] & mask[(i) % 8]) ? 1 : 0) &&
         !((t[(i - 1) / 8] & mask[(i - 1) % 8]) ? 1 : 0)))
      SA[--bkt[(cs == sizeof(int) ? ((int *)s)[i] : ((unsigned char *)s)[i])]] =
          i;
  induceSAl(t, SA, s, bkt, n, K, cs, false);
  induceSAs(t, SA, s, bkt, n, K, cs, true);
  free(bkt);
  int n1 = 0;
  for (i = 0; i < n; i++)
    if ((SA[i] > 0 && ((t[(SA[i]) / 8] & mask[(SA[i]) % 8]) ? 1 : 0) &&
         !((t[(SA[i] - 1) / 8] & mask[(SA[i] - 1) % 8]) ? 1 : 0)))
      SA[n1++] = SA[i];
  for (i = n1; i < n; i++) SA[i] = -1;
  int name = 0, prev = -1;
  for (i = 0; i < n1; i++) {
    int pos = SA[i];
    bool diff = false;
    for (int d = 0; d < n; d++)
      if (prev == -1 ||
          (cs == sizeof(int) ? ((int *)s)[pos + d]
                             : ((unsigned char *)s)[pos + d]) !=
              (cs == sizeof(int) ? ((int *)s)[prev + d]
                                 : ((unsigned char *)s)[prev + d]) ||
          ((t[(pos + d) / 8] & mask[(pos + d) % 8]) ? 1 : 0) !=
              ((t[(prev + d) / 8] & mask[(prev + d) % 8]) ? 1 : 0)) {
        diff = true;
        break;
      } else if (d > 0 &&
                 ((pos + d > 0 &&
                   ((t[(pos + d) / 8] & mask[(pos + d) % 8]) ? 1 : 0) &&
                   !((t[(pos + d - 1) / 8] & mask[(pos + d - 1) % 8]) ? 1
                                                                      : 0)) ||
                  (prev + d > 0 &&
                   ((t[(prev + d) / 8] & mask[(prev + d) % 8]) ? 1 : 0) &&
                   !((t[(prev + d - 1) / 8] & mask[(prev + d - 1) % 8]) ? 1
                                                                        : 0))))
        break;
    if (diff) {
      name++;
      prev = pos;
    }
    pos = (pos % 2 == 0) ? pos / 2 : (pos - 1) / 2;
    SA[n1 + pos] = name - 1;
  }
  for (i = n - 1, j = n - 1; i >= n1; i--)
    if (SA[i] >= 0) SA[j--] = SA[i];
  int *SA1 = SA, *s1 = SA + n - n1;
  if (name < n1)
    SA_IS((unsigned char *)s1, SA1, n1, name - 1, sizeof(int));
  else
    for (i = 0; i < n1; i++) SA1[s1[i]] = i;
  bkt = (int *)malloc(sizeof(int) * (K + 1));
  getBuckets(s, bkt, n, K, cs, true);
  for (i = 1, j = 0; i < n; i++)
    if ((i > 0 && ((t[(i) / 8] & mask[(i) % 8]) ? 1 : 0) &&
         !((t[(i - 1) / 8] & mask[(i - 1) % 8]) ? 1 : 0)))
      s1[j++] = i;
  for (i = 0; i < n1; i++) SA1[i] = s1[SA1[i]];
  for (i = n1; i < n; i++) SA[i] = -1;
  for (i = n1 - 1; i >= 0; i--) {
    j = SA[i];
    SA[i] = -1;
    SA[--bkt[(cs == sizeof(int) ? ((int *)s)[j] : ((unsigned char *)s)[j])]] =
        j;
  }
  induceSAl(t, SA, s, bkt, n, K, cs, false);
  induceSAs(t, SA, s, bkt, n, K, cs, true);
  free(bkt);
  free(t);
}
const int MX = 1500010;
int sa[MX];
int lcp[MX];
int rnk[MX];
unsigned char *s;
int n;
void calc_lcp() {
  for (int i = 0; i < n; i++) rnk[sa[i]] = i;
  for (int i = 0, h = 0; i < n; i++) {
    if (rnk[i] < n - 1) {
      for (int j = sa[rnk[i] + 1]; s[i + h] == s[j + h]; ++h)
        ;
      lcp[rnk[i]] = h;
      if (h > 0) --h;
    }
  }
}
int ll, rr, lim;
string cad[100001];
int acum[2][1000010];
int st[22][MX];
void add(int &a, int &b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
int lcp2(int l, int r) {
  l = rnk[l];
  r = rnk[r];
  if (l > r) swap(l, r);
  int T = r - l + 1;
  int lg = 31 - (__builtin_clz(T));
  return min(st[lg][l], st[lg][r - (1 << lg) + 1]);
}
void buildST() {
  for (int i = 0; i < n; i++) st[0][i] = n - sa[i];
  for (int h = 1; (1 << h) <= n; h++) {
    for (int i = 0; i + (1 << h) - 1 < n; i++) {
      st[h][i] = min({st[h - 1][i], st[h - 1][i + (1 << (h - 1))],
                      lcp[i - 1 + (1 << (h - 1))]});
    }
  }
  return;
}
void lcp_construction() {
  for (int i = 0; i < n; i++) rnk[sa[i]] = i;
  int k = 0;
  for (int i = 0; i < n; i++) {
    if (rnk[i] == n - 1) {
      k = 0;
      continue;
    }
    int j = sa[rnk[i] + 1];
    while (i + k < n && j + k < n && s[i + k] == s[j + k]) k++;
    lcp[rnk[i]] = k;
    if (k) k--;
  }
  buildST();
  return;
}
bool cmp(int a, int b) {
  int L, R;
  if (a < lim) {
    L = ll;
  } else {
    L = lim + 1;
  }
  if (a != L) L++;
  if (b < lim) {
    R = ll;
  } else {
    R = lim + 1;
  }
  if (b != R) R++;
  int preffix = min(a - L, b - R);
  int common = lcp2(L, R);
  if (common < preffix) return rnk[L] < rnk[R];
  if (a - L < b - R) {
    L = L + preffix + 1;
    R = R + preffix;
    preffix = b - R;
    common = lcp2(L, R);
    if (common < preffix) return rnk[L] < rnk[R];
    L = L + preffix;
    R = R + preffix + 1;
  } else if (a - L > b - R) {
    L = L + preffix;
    R = R + preffix + 1;
    preffix = a - L;
    common = lcp2(L, R);
    if (common < preffix) return rnk[L] < rnk[R];
    L = L + preffix + 1;
    R = R + preffix;
  } else {
    L = L + preffix + 1;
    R = R + preffix + 1;
  }
  return rnk[L] < rnk[R];
}
void solve(int lm, int posi) {
  int t = (posi & 1);
  vector<int> ord;
  for (int i = ll; i < rr; i++) {
    if (lm <= i && i <= lim) continue;
    ord.push_back(i);
  }
  sort(ord.begin(), ord.end(), cmp);
  int sum = 0;
  for (int i = 0; i < ord.size(); i++) {
    int pp = ord[i];
    if (pp < lim) {
      acum[t][pp - ll] = sum;
    } else if (pp > lim) {
      add(sum, acum[t ^ 1][pp - lim - 1]);
    }
  }
  return;
}
string tostring(int num) {
  string ans = "";
  while (num > 0) {
    ans += char(num % 26 + 'a');
    num /= 26;
  }
  while (ans.size() < 4) ans += 'a';
  reverse(ans.begin(), ans.end());
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(10);
  cout << fixed;
  vector<int> ini;
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> cad[i];
  if (N == 1) {
    cout << cad[0].size() + 1 << "\n";
    return 0;
  }
  string ss = "", numstr;
  for (int i = N - 1; i >= 0; i--) {
    ini.push_back(ss.size());
    numstr = tostring(i);
    ss += numstr;
    ini.push_back(ss.size());
    ss += cad[i] + "$";
    ini.push_back(ss.size());
  }
  reverse(ini.begin(), ini.end());
  for (int i = 0; i <= cad[0].size(); i++) acum[0][i] = 1;
  n = ss.size();
  s = (unsigned char *)ss.c_str();
  SA_IS(s, sa, n + 1, 256, 1);
  for (int i = 0; i < n; i++) sa[i] = sa[i + 1];
  lcp_construction();
  int lm;
  for (int i = 0; i < N - 1; i++) {
    ll = ini[(i + 1) * 3 + 1] - 1;
    lm = ini[(i + 1) * 3] - 1;
    lim = ini[i * 3 + 1] - 2;
    rr = ini[i * 3] - 1;
    solve(lm, i + 1);
  }
  int t = ((N - 1) & 1);
  int ans = 0;
  for (int i = 0; i <= cad[N - 1].size(); i++) add(ans, acum[t][i]);
  cout << ans << "\n";
  return 0;
}
