#include <bits/stdc++.h>
using namespace std;
const int N = 600000;
const int MOD = (int)1e9 + 7;
int n, m, k, u, v, g[N];
long long c[N], w[N];
set<long long> s;
vector<pair<long long, pair<int, int> > > e;
int find(int cur) { return cur == g[cur] ? g[cur] : g[cur] = find(g[cur]); }
int main() {
  scanf("%d %d %d", &n, &m, &k);
  w[0] = 1;
  for (int i = 1; i <= n; i++) {
    w[i] = 2LL * w[i - 1] % MOD;
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &c[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    u--;
    v--;
    s.insert(c[u] ^ c[v]);
    e.push_back({c[u] ^ c[v], make_pair(u, v)});
  }
  long long ans = (((1LL << k) - s.size()) % MOD) * w[n] % MOD;
  sort(e.begin(), e.end());
  for (int i = 0; i < e.size();) {
    int j = i;
    while (j < e.size() && e[i].first == e[j].first) {
      j++;
    }
    for (int p = i; p < j; p++) {
      int u = e[p].second.first;
      int v = e[p].second.second;
      g[u] = u;
      g[v] = v;
    }
    int c = n;
    for (int p = i; p < j; p++) {
      int u = e[p].second.first;
      int v = e[p].second.second;
      u = find(u);
      v = find(v);
      if (u != v) {
        c--;
        g[v] = u;
      }
    }
    ans += w[c];
    ans %= MOD;
    i = j;
  }
  printf("%lld\n", ans);
  return 0;
}
