#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int ca = 0;
  int n, m, k;
  cin >> n >> m >> k;
  vector<pair<long long, long long> > v;
  for (int i = 0; i < k; i++) {
    int x;
    cin >> x;
    v.push_back(make_pair(i + 1, x));
  }
  int sum = 0;
  while (n--) {
    for (int i = 0; i < m; i++) {
      int x, xxx, tmp;
      ;
      cin >> x;
      vector<pair<long long, long long> > nw;
      for (int it = 0; it < v.size(); it++) {
        if (v[it].second == x) {
          sum += v[it].first;
          tmp = v[it].second;
          nw.push_back(make_pair(1, x));
          xxx = it;
          break;
        }
      }
      int cnt = 2;
      for (int it = 0; it < v.size(); it++) {
        if (v[it].second != x) {
          nw.push_back(make_pair(cnt, v[it].second));
          cnt++;
        }
      }
      v = nw;
    }
  }
  cout << sum;
}
