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