#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1000000000;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
struct IOSetup {
  IOSetup() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(12);
  }
} iosetup;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++)
    os << v[i] << (i + 1 == (int)v.size() ? "" : " ");
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v) is >> x;
  return is;
}
signed main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> p(k);
  cin >> p;
  ll res = 0;
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (m); j++) {
      int t;
      cin >> t;
      int x = 0;
      while (p[x] != t) x++;
      res += x + 1;
      vector<int> np(k);
      np[0] = t;
      for (int y = 0; y < (x); y++) np[y + 1] = p[y];
      for (int y = x + 1; y < k; y++) np[y] = p[y];
      swap(p, np);
    }
  }
  cout << res << endl;
  return 0;
}
