#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T1, typename T2>
inline void chkmin(T1 &x, const T2 &y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void chkmax(T1 &x, const T2 &y) {
  if (x < y) x = y;
}
const int MOD = 1e9 + 7;
int add(int a, int b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) {
    a += MOD;
  }
  return a;
}
int mul(int a, int b) { return (ll)a * b % MOD; }
const int MAXN = 1e5 + 10;
int n;
string a[MAXN];
vector<int> order[MAXN];
vector<int> dp[2];
int ans;
void read() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
}
void buildOrder() {
  for (int i = 0; i < n; i++) {
    order[i].resize(a[i].size() + 1);
    iota(order[i].begin(), order[i].end(), 0);
    sort(order[i].begin(), order[i].end(), [&](int pos1, int pos2) -> bool {
      string sa = a[i];
      if (pos1 < (int)sa.size()) sa.erase(sa.begin() + pos1);
      string sb = a[i];
      if (pos2 < (int)sb.size()) sb.erase(sb.begin() + pos2);
      return sa < sb;
    });
  }
}
bool checkGood(int ind1, int pos1, int ind2, int pos2) {
  string sa = a[ind1];
  if (pos1 < (int)sa.size()) sa.erase(sa.begin() + pos1);
  string sb = a[ind2];
  if (pos2 < (int)sb.size()) sb.erase(sb.begin() + pos2);
  return sa <= sb;
}
void calcDp() {
  dp[0].assign(a[0].size() + 1, 1);
  for (int i = 1; i < n; i++) {
    dp[1].assign(a[i].size() + 1, 0);
    int sum = 0;
    int pos1 = 0;
    for (int pos2 = 0; pos2 <= (int)a[i].size(); pos2++) {
      while (pos1 <= (int)a[i - 1].size() &&
             checkGood(i - 1, order[i - 1][pos1], i, order[i][pos2])) {
        sum = add(sum, dp[0][order[i - 1][pos1]]);
        pos1++;
      }
      dp[1][order[i][pos2]] = sum;
    }
    swap(dp[0], dp[1]);
  }
}
void calcAns() {
  ans = 0;
  for (int i = 0; i < (int)dp[0].size(); i++) {
    ans = add(ans, dp[0][i]);
  }
}
void run() {
  buildOrder();
  calcDp();
  calcAns();
}
void write() { cout << ans << endl; }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read();
  run();
  write();
  return 0;
}
