#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e6 + 7, MOD = 11933, inf = 1e9, N = 33;
int x, y, n, m, k, ans;
deque<int> q;
int main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= k; i++) cin >> x, q.push_back(x);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> x;
      for (int l = 0; l < q.size(); l++) {
        if (q[l] == x) ans += l + 1, q.erase(q.begin() + l), q.push_front(x);
      }
    }
  }
  return cout << ans << "\n", 0;
}
