#include <bits/stdc++.h>
using namespace std;
int n, K, m, a[101][101];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> K;
  deque<int> p(K);
  for (int i = 0; i < (int)K; ++i) cin >> p[i];
  for (int i = 0; i < (int)n; ++i)
    for (int j = 0; j < (int)m; ++j) cin >> a[i][j];
  int res = 0;
  for (int i = 0; i < (int)n; ++i)
    for (int j = 0; j < (int)m; ++j) {
      for (int k = 0; k < (int)K; ++k) {
        if (p[k] == a[i][j]) {
          res += k + 1;
          p.erase(p.begin() + k);
          p.push_front(a[i][j]);
          break;
        }
      }
    }
  cout << res << endl;
}
