#include <bits/stdc++.h>
using namespace std;
vector<int> fillvec(int size) {
  vector<int> ans;
  for (int i = 0; i < size; i++) {
    int temp;
    cin >> temp;
    ans.push_back(temp);
  }
  return ans;
}
int gcd(int a, int b) { return !a ? b : gcd(b % a, a); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int amtpeople, amtitems, totnum;
  cin >> amtpeople >> amtitems >> totnum;
  vector<int> items = fillvec(totnum);
  vector<vector<int>> orders;
  for (int i = 0; i < amtpeople; i++) {
    vector<int> order;
    for (int j = 0; j < amtitems; j++) {
      int temp;
      cin >> temp;
      order.push_back(temp);
    }
    orders.push_back(order);
  }
  int dist = 0;
  int pos;
  for (int i = 0; i < amtpeople; i++) {
    for (int j = 0; j < amtitems; j++) {
      pos = find(items.begin(), items.end(), orders[i][j]) - items.begin();
      dist += pos + 1;
      items.erase(items.begin() + pos);
      items.insert(items.begin(), orders[i][j]);
    }
  }
  cout << dist << endl;
}
