#include <bits/stdc++.h>
using namespace std;
int const maxn = 1e5 + 10;
int arr[maxn * 2];
long long m;
long long book[maxn * 2];
int books[maxn * 2];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) {
    scanf("%d", arr + i);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] == arr[i + n]) cnt++;
  }
  cin >> m;
  book[1] = book[0] = 1;
  int t, c;
  for (int i = 2; i <= 2 * n; i++) {
    c = 0;
    t = i;
    while (t % 2 == 0) {
      c++;
      t >>= 1;
    }
    book[i] = book[i - 1] * t % m;
    books[i] = books[i - 1] + c;
  }
  sort(arr + 1, arr + 1 + 2 * n);
  int d = 1;
  arr[0] = -1;
  long long ans = 1;
  for (int i = 2; i <= 2 * n + 1; i++) {
    if (arr[i] == arr[i - 1]) {
      d++;
    } else {
      ans *= book[d];
      ans %= m;
      cnt -= books[d];
      d = 1;
    }
  }
  while (cnt < 0) {
    ans *= 2;
    ans %= m;
    cnt++;
  }
  cout << ans << endl;
}
