#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const long long maxn = 200005;
long long a[maxn];
map<long long, long long> cont;
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  cin.exceptions(cin.failbit);
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    for (long long i = 0, _n = (2 * n); i < _n; i++) cin >> a[i];
    for (long long i = 0, _n = (n); i < _n; i++) {
      if (a[i] == a[i + n]) {
        if (cont.find(a[i]) != cont.end())
          cont[a[i]]++;
        else
          cont[a[i]] = 1;
      }
    }
    long long m;
    cin >> m;
    sort(a, a + 2 * n);
    long long temp = 1;
    long long ans = 1;
    for (long long i = 0, _n = (2 * n); i < _n; i++) {
      if (a[i] == a[i + 1]) {
        temp++;
      } else {
        long long z = 1;
        long long da = cont.find(a[i]) == cont.end() ? 0 : cont[a[i]];
        ;
        for (long long lo = (1), _b = (temp); lo <= _b; lo++) {
          long long x = lo;
          while (da && x % 2 == 0) {
            x /= 2;
            da--;
          }
          z = (z * x) % m;
        };
        ans = (ans * z) % m;
        temp = 1;
      }
    }
    cout << ans;
  };
}
