#include <bits/stdc++.h>
using namespace std;
const int NMAX = 4000;
vector<int> pos;
int v[NMAX], k;
int n, result, m;
inline void SaMoaraDusmanii(const vector<int>& A) {
  for (int i = (0); i <= (A.size() - 1); ++i) {
    int found = 0;
    for (int j = (0); j <= (pos.size() - 1); ++j) {
      if (pos[j] == A[i]) {
        found = j;
        break;
      }
    }
    pos.insert(pos.begin(), A[i]);
    pos.erase(pos.begin() + found + 1);
    result += (found + 1);
  }
}
inline void DaCuBanii() {
  cin >> n >> m;
  cin >> k;
  for (int i = (1); i <= (k); ++i) {
    int x;
    cin >> x;
    pos.push_back(x);
  }
  for (int i = (1); i <= (n); ++i) {
    int x;
    vector<int> A;
    for (int j = (1); j <= (m); ++j) {
      cin >> x;
      A.push_back(x);
    }
    SaMoaraDusmanii(A);
  }
  cout << result;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(NULL);
  DaCuBanii();
  return 0;
}
