#include <bits/stdc++.h>
using namespace std;
int n, k, m;
int p[1007];
void read() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    int x;
    scanf("%d", &x);
    p[x] = i;
  }
}
void solve() {
  int res = 0;
  for (int i = 0; i < n * m; i++) {
    int x;
    scanf("%d", &x);
    res += p[x];
    for (int j = 1; j <= k; j++)
      if (j != x && p[j] < p[x]) p[j]++;
    p[x] = 1;
  }
  printf("%d\n", res);
}
int main() {
  read();
  solve();
  return 0;
}
