#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 110;
struct Input {
  int n, m, k;
  int pos[N];
  int a[N][N];
  bool read() {
    if (scanf("%d%d%d", &n, &m, &k) != 3) return 0;
    for (int i = int(0); i < int(k); ++i) {
      scanf("%d", &pos[i]);
      pos[i]--;
    }
    for (int i = int(0); i < int(n); ++i) {
      for (int j = int(0); j < int(m); ++j) {
        scanf("%d", &a[i][j]);
        a[i][j]--;
      }
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  int ans;
  void write() { cout << ans << endl; }
  virtual void solve() {}
  virtual void clear() { *this = Data(); }
};
struct Solution : Data {
  vector<int> tek;
  void solve() {
    tek.resize(k);
    for (int i = int(0); i < int(k); ++i) {
      tek[i] = pos[i];
    }
    for (int i = int(0); i < int(n); ++i) {
      for (int j = int(0); j < int(m); ++j) {
        int kk = a[i][j];
        int pos = -1;
        for (int t = int(0); t < int(k); ++t) {
          if (tek[t] == kk) {
            pos = t;
            break;
          }
        }
        ans += pos + 1;
        tek.erase(tek.begin() + pos);
        tek.insert(tek.begin(), kk);
      }
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
