#include <bits/stdc++.h>
using namespace std;
const int mx = 100100;
int n, m, k;
int a[mx];
int pos[mx];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> k;
  long long ans = 0;
  for (int i = 1; i <= k; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  while (n--) {
    for (int i = 0, x; i < m; i++) {
      cin >> x;
      ans += pos[x];
      for (int j = pos[x]; j > 1; j--) {
        swap(a[j], a[j - 1]);
        pos[a[j]]++;
      }
      pos[x] = 1;
    }
  }
  cout << ans << "\n";
  return 0;
}
