#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int N = 2048;
int main() {
  int ans = 0, n, m, k, a[1024], t;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &t);
      for (int p = 1; p <= k; p++) {
        if (a[p] == t) {
          ans += p;
          a[p] = a[0];
          a[1] = t;
          break;
        } else {
          swap(a[p], a[0]);
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
