#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1, tmp;
  cin >> n >> m >> k;
  long long a[k + 1];
  map<long long, long long> mp, mp1;
  flag = 0;
  for (i = 1; i <= k; i++) {
    cin >> a[i];
    mp[a[i]] = i;
    mp1[a[i]]++;
    if (mp1[a[i]] >= 2) {
      flag = 1;
    }
  }
  sum = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> b;
      sum += mp[b];
      l = a[1];
      a[1] = b;
      for (k = 2; k <= mp[b]; k++) {
        long long d = a[k];
        a[k] = l;
        mp[l] = k;
        l = d;
      }
      mp[b] = 1;
    }
  }
  cout << sum << endl;
}
