#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[k];
  for (int i = 0; i < k; i++) cin >> a[i];
  map<int, int> ma;
  for (int i = 0; i < k; i++) ma[a[i]] = i + 1;
  int time = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int x;
      cin >> x;
      time = time + ma[x];
      int pos = ma[x];
      for (auto it = ma.begin(); it != ma.end(); it++) {
        if (it->second < pos) it->second++;
      }
      ma[x] = 1;
    }
  }
  cout << time;
  return 0;
}
