#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("arch=corei7-avx")
using ll = long long;
using namespace std;
template <class A>
void addlog(A a) {
  cerr << a << endl;
}
template <class A, class... B>
void addlog(A a, B... b) {
  cerr << a << ' ';
  addlog(b...);
}
template <class T>
ostream& operator<<(ostream& out, vector<T> v) {
  for (T& e : v) {
    out << e << ' ';
  }
  return out;
}
namespace program {
namespace dsu {
vector<ll> p, s, toClear;
ll comps, len;
void build(ll n) {
  p.assign(n + 1, -1);
  s.assign(n + 1, 1);
  comps = n;
  len = n;
}
ll get(ll x) {
  assert(x >= 0);
  if (p[x] < 0) return x;
  return get(p[x]);
}
void merge(ll x, ll y) {
  x = get(x);
  y = get(y);
  if (x != y) {
    --comps;
    toClear.emplace_back(x);
    toClear.emplace_back(y);
    if (s[x] > s[y]) {
      p[y] = x;
      s[x] += s[y];
    } else {
      p[x] = y;
      s[y] += s[x];
    }
  }
}
ll compCount() { return comps; }
void clear() {
  comps = len;
  for (ll e : toClear) {
    p[e] = -1;
    s[e] = 1;
  }
  toClear.clear();
}
}  // namespace dsu
const ll M = 1e9 + 7, N = 5e5 + 5;
ll n, m, k;
vector<ll> ccc;
map<ll, vector<pair<ll, ll>>> es;
ll p2[N];
void run() {
  p2[0] = 1;
  for (ll pw = 1; pw < N; ++pw) {
    p2[pw] = (p2[pw - 1] * 2) % M;
  }
  cin >> n >> m >> k;
  dsu::build(n);
  ccc.resize(n);
  for (ll i = 0; i < n; ++i) cin >> ccc[i];
  for (ll a, b, i = 0; i < m; ++i) {
    cin >> a >> b;
    --a;
    --b;
    ll curx = ccc[a] ^ ccc[b];
    es[curx].emplace_back(a, b);
  }
  ll answer = 0;
  for (auto& pr : es) {
    const vector<pair<ll, ll>>& edges = pr.second;
    dsu::clear();
    for (auto& edge : edges) {
      dsu::merge(edge.first, edge.second);
    }
    ll ccnt = dsu::compCount();
    answer += p2[max(0LL, ccnt)];
    answer %= M;
  }
  ll un = (1LL << k) - (ll)(es.size());
  un %= M;
  answer += p2[n] * un;
  answer %= M;
  cout << answer << endl;
}
}  // namespace program
int main() {
  ios::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  program::run();
  return 0;
}
