#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const int maxn = 1e6 + 5;
int n, m, k;
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  v.resize(k);
  for (int& x : v) cin >> x;
  int ans = 0;
  while (n--) {
    vector<int> need(m);
    for (int& x : need) cin >> x;
    for (int x : need) {
      vector<int> nxt = {x};
      for (int j = 0; j < k; j++) {
        if (v[j] == x) {
          ans += j + 1;
        } else {
          nxt.push_back(v[j]);
        }
      }
      swap(nxt, v);
    }
  }
  cout << ans << endl;
  return 0;
}
