#include <bits/stdc++.h>   using namespace std;   int b[205];   int a[205];   int main() {     int n, m, k;     int x;     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= k; i++) {       scanf( %d , &x);       a[i] = x;     }     int sum = 0;     int mm = m;     while (n--) {       mm = m;       while (mm--) {         scanf( %d , &x);         int sb;         for (int j = 1; j <= k; j++) {           if (x == a[j]) {             sb = j;           }         }         sum += sb;         b[1] = a[sb];         int count = 2;         for (int j = 1; j <= k; j++) {           if (j != sb) {             b[count++] = a[j];           }         }         for (int j = 1; j <= k; j++) {           a[j] = b[j];         }       }     }     cout << sum << endl;   }   