#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, time = 0, now, temp;
  scanf("%d%d%d", &n, &m, &k);
  int arr[k + 1], pos[k + 1];
  for (int i = 1; i <= k; i++) {
    scanf("%d", &arr[i]);
    pos[arr[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &now);
      time += pos[now];
      temp = pos[now];
      for (int k = temp; k > 1; k--) {
        arr[k] = arr[k - 1];
        pos[arr[k]] = k;
      }
      arr[1] = now;
      pos[now] = 1;
    }
  }
  printf("%d\n", time);
}
