#include <bits/stdc++.h>
using namespace std;
const int inf = ((1 << 30) - 1);
const long long linf = ((1ll << 62) - 1);
const char* fin = "input.txt";
const char* fout = "output.txt";
int n, m;
vector<pair<int, int> > a;
vector<int> fact, divFact;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  a.resize(2 * n);
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i + 1;
  for (int i = 0; i < n; i++) cin >> a[i + n].first, a[i + n].second = i + 1;
  cin >> m;
  sort((a).begin(), (a).end());
  for (int i = 0; i < ((int)(a).size()); i++) {
    int r = i;
    while (r < ((int)(a).size()) && a[i].first == a[r].first) ++r;
    for (int j = i; j < r; j++) {
      int rs = j;
      while (rs < r && a[j] == a[rs]) ++rs;
      divFact.push_back(rs - j);
      j = rs - 1;
    }
    fact.push_back(r - i);
    i = r - 1;
  }
  int cnt = 0;
  for (__typeof((divFact).begin()) i = (divFact).begin(); i != (divFact).end();
       ++i) {
    assert(*i <= 2);
    if (*i == 2) ++cnt;
  }
  int ans = 1;
  for (__typeof((fact).begin()) i = (fact).begin(); i != (fact).end(); ++i) {
    for (int j = 2; j <= *i; j++) {
      int t = j;
      while (cnt > 0 && t % 2 == 0) t /= 2, --cnt;
      ans = (1ll * ans * t) % m;
    }
  }
  cout << ans << '\n';
  return 0;
}
