#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, ai;
  cin >> n;
  map<pair<long long int, long long int>, int> mp;
  vector<long long int> c;
  for (long long int i = 0; i < n; i++) {
    cin >> ai;
    c.push_back(ai);
    mp[{ai, i}]++;
  }
  for (long long int i = 0; i < n; i++) {
    cin >> ai;
    c.push_back(ai);
    mp[{ai, i}]++;
  }
  cin >> m;
  long long int d2 = 0;
  for (auto c : mp) {
    if (c.second == 2) d2++;
  }
  sort(c.begin(), c.end());
  long long int ans = 1;
  for (long long int i = 0; i < 2 * n;) {
    long long int j = i + 1;
    while (j < 2 * n && c[j] == c[i]) j++;
    for (long long int k = 1; k <= j - i; k++) {
      long long int p = k;
      while (p % 2 == 0 && d2) {
        d2--;
        p /= 2;
      }
      (ans *= p) %= m;
    }
    i = j;
  }
  cout << ans << endl;
  return 0;
}
