#include <bits/stdc++.h>
using namespace std;
int Pos[1 << (24)], dp[1 << (24)];
int a, b;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> Pos[1 << i];
  }
  int m;
  cin >> m;
  if (m) cin >> a, m--;
  if (m) cin >> b, m--;
  int upper = 1 << n;
  dp[0] = 1;
  for (int i = 1; i < upper; ++i) {
    int GetLow = ((i) & (-(i))), tmp = i;
    Pos[i] = Pos[GetLow] + Pos[GetLow ^ i];
    if (Pos[i] == a || Pos[i] == b) continue;
    while (tmp) {
      int s = dp[i] + dp[GetLow ^ i];
      dp[i] = s > (1000000007) ? s - (1000000007) : s;
      tmp ^= ((tmp) & (-(tmp)));
      GetLow = ((tmp) & (-(tmp)));
    }
  }
  cout << dp[(1 << n) - 1] << endl;
  return 0;
}
