#include <bits/stdc++.h>
using namespace std;
int a[105], k, ans = 0;
inline void qwq(int x) {
  int w = 0;
  for (int i = 1; i <= k; i++) {
    if (a[i] == x) {
      w = i;
      break;
    }
  }
  ans += w;
  for (int i = w - 1; i >= 1; i--) a[i + 1] = a[i];
  a[1] = x;
}
int main(int argc, char** argv) {
  int n, m;
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) cin >> a[i];
  for (int i = 1; i <= n * m; i++) {
    int x;
    cin >> x;
    qwq(x);
  }
  cout << ans;
  return 0;
}
