#include <bits/stdc++.h>
using namespace std;
pair<int, int> s[200005];
unsigned long long fact[200005];
int main() {
  int n, v, pow2 = 0;
  unsigned long long m, res = 1;
  vector<unsigned long long> fact2;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> v;
    s[i] = make_pair(v, i + 1);
  }
  for (int i = n; i < 2 * n; ++i) {
    cin >> v;
    s[i] = make_pair(v, i - n + 1);
  }
  cin >> m;
  sort(s, s + 2 * n);
  for (int i = 0; i < 2 * n; ++i) {
    int cnt = 1;
    while (s[i].first == s[i + 1].first) {
      if (s[i].second == s[i + 1].second) {
        ++pow2;
      }
      ++cnt;
      ++i;
      fact2.push_back(cnt);
    }
  }
  for (int i = 0; i < fact2.size(); ++i) {
    while ((fact2[i] & 1) == 0 && pow2) {
      pow2--;
      fact2[i] >>= 1;
    }
    res = ((res % m) * (fact2[i] % m)) % m;
  }
  assert(pow2 == 0);
  cout << res << endl;
  return 0;
}
