#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const long long MOD = 1e9 + 7;
long long C[500009], P[500009];
int p[500009];
int root(int x) {
  if (p[x] == x) return x;
  return p[x] = root(p[x]);
}
bool merg(int u, int v) {
  u = root(u);
  v = root(v);
  if (u != v) {
    p[u] = v;
    return true;
  }
  return false;
}
int main() {
  P[0] = 1;
  for (int i = 1; i <= 500000; i++) P[i] = P[i - 1] * 2LL % MOD;
  int N, M, K;
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; i++) scanf("%lld", &C[i]);
  vector<pair<long long, pii> > dk;
  for (int i = 0; i < M; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    dk.push_back({C[u] ^ C[v], {u, v}});
  }
  sort(dk.begin(), dk.end());
  vector<int> used;
  long long ans = 0;
  int gr = N, c = 1;
  for (int i = 1; i <= N; i++) p[i] = i;
  for (int i = 0; i < (int)dk.size() + 1; i++) {
    if (i == (int)dk.size() || (i && dk[i].first != dk[i - 1].first)) {
      ans += P[gr];
      ans %= MOD;
      if (i == (int)dk.size()) break;
      gr = N;
      for (auto& it : used) p[it] = it;
      used.clear();
      ++c;
    }
    int u, v;
    tie(u, v) = dk[i].second;
    used.push_back(u);
    used.push_back(v);
    if (merg(u, v)) --gr;
  }
  ans += (P[K] - c + MOD) * P[N] % MOD;
  ans %= MOD;
  printf("%lld", ans);
  return 0;
}
