#include <bits/stdc++.h>
using namespace std;
int i, cs, cnt, st, ed, j, k, m, p, a[105], ans, n, x, r;
char ch, c;
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= k; i++) cin >> a[i];
  while (n--) {
    for (i = 1; i <= m; i++) {
      cin >> x;
      for (j = 1; j <= k; j++) {
        if (a[j] == x) {
          ans += j;
          break;
        }
      }
      for (r = j; r > 1; r--) swap(a[r], a[r - 1]);
    }
  }
  cout << ans << endl;
}
