#include <bits/stdc++.h>
using namespace std;
const int size = 200000;
long long arr[size + 10];
int main() {
  cin.sync_with_stdio(false);
  long long n, x, res, temp, num, cnt, m;
  while (cin >> n) {
    cnt = 0;
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
    }
    for (int i = n; i < 2 * n; ++i) {
      cin >> arr[i];
      if (arr[i] == arr[i - n]) {
        ++cnt;
      }
    }
    cin >> m;
    sort(arr, arr + 2 * n);
    res = num = 1;
    for (int i = 1; i < 2 * n; ++i) {
      if (arr[i] == arr[i - 1]) {
        ++num;
        res *= num;
        while (cnt && res % 2 == 0) {
          --cnt;
          res /= 2;
        }
        res %= m;
      } else {
        num = 1;
      }
    }
    cout << res % m << endl;
  }
  return 0;
}
