#include <bits/stdc++.h>
#pragma optimise GCC(-O2)
using namespace std;
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
long long rng(long long lim) {
  uniform_int_distribution<long long> uid(0, lim - 1);
  return uid(rang);
}
long long INF = LLONG_MAX;
const long long M = 1000000007;
long long powm(long long, long long);
map<pair<long long, long long>, long long> mp;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long m;
  cin >> m;
  long long k;
  cin >> k;
  vector<long long> a(k);
  for (long long i = 0; i < k; i++) cin >> a[k - 1 - i];
  long long tim = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      long long x;
      cin >> x;
      for (long long i = k - 1; i >= 0; i--) {
        if (a[i] == x) {
          tim += (k - i);
          a.erase(a.begin() + i);
          a.push_back(x);
          break;
        }
      }
    }
  }
  cout << tim;
}
long long powm(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
