#include <bits/stdc++.h>
using namespace std;
int inp[105][105];
int init[105];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &init[i]);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &inp[i][j]);
      int p = k;
      for (p = k; p >= 1; p--)
        if (init[p] == inp[i][j]) break;
      ans += p;
      while (p > 1) {
        swap(init[p], init[p - 1]);
        p--;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
