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