#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[105], pos[105];
int n, m, k;
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a[i]);
    pos[a[i]] = i;
  }
  int k;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &k);
      ans += pos[k];
      int kk = pos[k];
      int k1 = pos[k];
      for (; kk >= 2; kk--) {
        swap(a[kk], a[kk - 1]);
      }
      for (int i = 1; i <= k1; i++) {
        pos[a[i]] = i;
      }
    }
  }
  printf("%d\n", ans);
}
