#include <bits/stdc++.h>
using namespace std;
long long int arr[10000];
int main() {
  long long int n, m, k;
  scanf("%lld%lld", &n, &m);
  scanf("%lld", &k);
  for (long long int i = 1; i <= k; i++) {
    scanf("%lld", &arr[i]);
  }
  long long int ans = 0;
  for (long long int l = 0; l < n; l++) {
    for (long long int g = 0; g < m; g++) {
      long long int a, cnt = 0;
      scanf("%lld", &a);
      for (long long int i = 1; i <= k; i++) {
        if (arr[i] == a) {
          cnt = i;
          for (long long int j = i; j >= 2; j--) {
            arr[j] = arr[j - 1];
          }
          arr[1] = a;
          break;
        }
      }
      ans += cnt;
    }
  }
  cout << ans << endl;
}
