#include <bits/stdc++.h>
using namespace std;
int main() {
  int v[200];
  int i, j, t, temp, ans = 0, x, n, m, k;
  cin >> n >> m >> k;
  for (i = 1; i <= k; i++) {
    scanf("%d", &x);
    v[x] = i;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%d", &x);
      temp = v[x];
      for (t = 1; t <= k; t++)
        if (v[t] < temp) v[t]++;
      v[x] = 1;
      ans += temp;
    }
  }
  cout << ans << endl;
  return 0;
}
