#include <bits/stdc++.h>
using namespace std;
template <class _T>
inline _T sqr(const _T& first) {
  return first * first;
}
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
const long double EPS = 4e-5;
char TEMPORARY_CHAR;
const int INF = 2e9;
inline void input(int& a) {
  a = 0;
  while (((TEMPORARY_CHAR = getchar()) > '9' || TEMPORARY_CHAR < '0') &&
         (TEMPORARY_CHAR != '-')) {
  }
  char neg = 0;
  if (TEMPORARY_CHAR == '-') {
    neg = 1;
    TEMPORARY_CHAR = getchar();
  }
  while (TEMPORARY_CHAR <= '9' && TEMPORARY_CHAR >= '0') {
    a = (a << 3) + (a << 1) + TEMPORARY_CHAR - '0';
    TEMPORARY_CHAR = getchar();
  }
  if (neg) a = -a;
}
inline void out(int a) {
  if (!a) putchar('0');
  if (a < 0) {
    putchar('-');
    a = -a;
  }
  char s[10];
  int i;
  for (i = 0; a; ++i) {
    s[i] = '0' + a % 10;
    a /= 10;
  }
  for (int j = (i)-1; j >= 0; j--) putchar(s[j]);
}
inline int nxt() {
  int(ret);
  input((ret));
  ;
  return ret;
}
int mod = 1000000007;
int main() {
  int(n);
  input((n));
  ;
  int M = 1 << n;
  int* s = new int[M];
  s[0] = 0;
  for (int i = 0; i < (int)(n); i++) s[1 << i] = nxt();
  for (int i = 0; i < (int)(M); i++) {
    if (!i) continue;
    int pr = i & (-i);
    s[i] = s[pr] + s[i ^ pr];
    if (s[i] >= mod) s[i] = mod;
  }
  int(k);
  input((k));
  ;
  long long b[k];
  for (int i = 0; i < (int)(k); i++) b[i] = nxt();
  s[0] = 1;
  for (int i = 0; i < (int)(M); i++) {
    if (!i) continue;
    bool fl = true;
    for (int j = 0; j < (int)(k); j++)
      if (s[i] == b[j]) {
        s[i] = 0;
        fl = false;
      }
    if (fl) {
      int ans = 0;
      for (int j = 0; j < (int)(n); j++)
        if ((i >> j) & 1) {
          ans += s[i ^ (1 << j)];
          if (ans >= mod) ans -= mod;
        }
      s[i] = ans;
    }
  }
  cout << s[M - 1] << endl;
  return 0;
}
