#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
map<int, int> mmp;
int n, m, k;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  int tmp;
  for (int i = 1; i <= k; i++) {
    scanf("%d", &tmp);
    mp[tmp] = i;
    mmp[i] = tmp;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &tmp);
      ans += mp[tmp];
      for (int k = mp[tmp] - 1; k >= 1; k--) {
        int val = mmp[k];
        mp[val] = k + 1;
        mmp[k + 1] = val;
      }
      mp[tmp] = 1;
      mmp[1] = tmp;
    }
  }
  printf("%d\n", ans);
  return 0;
}
