#include <bits/stdc++.h>
using namespace std;
struct node {
  node *pre;
  node *nxt;
  int p;
  node() {
    pre = NULL;
    nxt = NULL;
    p = 0;
  }
};
int n, m, k, a;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  node *head, *q, *p;
  int t;
  head = new node();
  q = head;
  for (int i = 1; i <= k; i++) {
    scanf("%d", &t);
    p = new node();
    p->p = t;
    p->pre = q;
    q->nxt = p;
    q = p;
  }
  p = new node();
  p->pre = q;
  q->nxt = p;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a);
      p = head->nxt;
      while (p->p != a) {
        p = p->nxt;
        ans++;
      }
      ans++;
      p->pre->nxt = p->nxt;
      p->nxt->pre = p->pre;
      delete p;
      p = new node();
      p->p = a;
      p->pre = head;
      p->nxt = head->nxt;
      head->nxt->pre = p;
      head->nxt = p;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
