#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> items(k + 1);
  for (int i = 1; i <= k; i++) {
    int num;
    cin >> num;
    items[num] = i;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int num, index;
      cin >> num;
      index = items[num];
      ans += index;
      for (int x = 1; x <= k; x++) {
        if (items[x] < index) {
          items[x] += 1;
        }
      }
      items[num] = 1;
    }
  }
  cout << ans << endl;
}
