#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
  bool operator<(const Point &T) const {
    if (x == T.x) return (y < T.y);
    return (x < T.x);
  }
};
struct Matrix {
  long long d[4][4];
  int mod;
  Matrix operator*(const Matrix &A) const {
    Matrix ans;
    ans.mod = mod;
    for (int i = 0; i <= 3; i++)
      for (int j = 0; j <= 3; j++) ans.d[i][j] = 0;
    for (int i = 0; i <= 3; i++) {
      for (int j = 0; j <= 3; j++) {
        for (int k = 0; k <= 3; k++) {
          ans.d[i][j] += (A.d[i][k] * d[k][j]);
          ans.d[i][j] %= mod;
        }
      }
    }
    return ans;
  }
  Matrix operator^(const int n) const {
    Matrix ans;
    ans.mod = mod;
    for (int i = 0; i <= 3; i++)
      for (int j = 0; j <= 3; j++) ans.d[i][j] = d[i][j];
    if (n == 1) return ans;
    Matrix t = ans ^ (n / 2);
    if (n % 2 == 0) return (t * t);
    return (t * t * ans);
  }
};
int a[1001], n, m, k, ans, x;
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &x);
      for (int l = 1; l <= k; l++) {
        if (a[l] == x) {
          ans += l;
          for (int h = l - 1; h >= 1; h--) swap(a[h], a[h + 1]);
          break;
        }
      }
    }
  }
  cout << ans;
  return 0;
}
