#include <bits/stdc++.h>
using namespace std;
int ans, t, n, m, i, j, k, a, b, c, d, e, f, sz, q, cases, sum, pos;
string s, s2, s3, s4, s5, s6;
vector<int> v;
int ar[(int)(1e6 + 10)];
void brainfuck();
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  brainfuck();
  return 0;
}
void brainfuck() {
  deque<int> dq;
  cin >> n >> m >> k;
  for (i = 1; i <= k; i++) {
    cin >> a;
    dq.push_back(a);
  }
  while (n--) {
    sum = 0;
    b = m;
    while (b--) {
      cin >> a;
      for (i = 0; i < k; i++) {
        if (dq[i] == a) {
          pos = i;
          sum += pos + 1;
          break;
        }
      }
      dq.erase(dq.begin() + pos);
      dq.push_front(a);
    }
    ans += sum;
  }
  cout << ans;
}
