#include <bits/stdc++.h>
using namespace std;
int niz[105];
int k;
int moveit(int val) {
  if (niz[1] == val) return 1;
  int price, tmp, tmp2;
  tmp = niz[1];
  niz[1] = val;
  for (int i = 2; i <= k; ++i) {
    if (niz[i] == val) {
      price = i;
      niz[i] = tmp;
      break;
    } else {
      tmp2 = tmp;
      tmp = niz[i];
      niz[i] = tmp2;
    }
  }
  return price;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, tmp;
  cin >> n >> m >> k;
  for (int i = 1; i <= k; ++i) cin >> niz[i];
  long long suma = 0;
  for (int j = 0; j < n; ++j) {
    for (int i = 0; i < m; ++i) {
      cin >> tmp;
      suma += moveit(tmp);
    }
  }
  cout << suma;
  return 0;
}
