#include <bits/stdc++.h>
using namespace std;
int N, M;
map<int, set<int> > m;
map<int, int> cnt;
int main() {
  cin >> N;
  for (int k = 0; k < 2; k++)
    for (int i = 1; i <= N; i++) {
      int tmp;
      cin >> tmp;
      m[tmp].insert(i);
      cnt[tmp]++;
    }
  cin >> M;
  map<int, set<int> >::iterator it;
  map<int, int>::iterator itt;
  int ans = 1;
  for (it = m.begin(), itt = cnt.begin(); it != m.end(); itt++, it++) {
    if (it->second.size()) {
      int c = itt->second - it->second.size();
      for (int i = 2; i <= itt->second; i++) {
        int t = i;
        while (t % 2 == 0 && --c >= 0) t /= 2;
        ans = (long long)ans * t % M;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
