#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1.0);
const int MOD = pow(10, 9) + 7;
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
inline void finish() {
  cout << -1 << endl;
  exit(0);
}
template <typename T>
inline void debug(vector<T> v) {
  cout << "[";
  for (size_t i = 0; i < v.size() - 1; ++i) {
    cout << v[i] << ", ";
  }
  cout << v[v.size() - 1] << "]" << endl;
}
class Pos {
 public:
  double x, y;
  Pos(double x, double y) {
    this->x = x;
    this->y = y;
  }
  Pos() {
    x = 0.0;
    y = 0.0;
  }
};
static class Mod {
 public:
  static inline ll Add(ll a, ll b) { return (a + b) % MOD; }
  static inline ll Sub(ll a, ll b) {
    ll ans = (a - b) % MOD;
    return (ans < 0) ? (ans + MOD) : ans;
  }
  static inline ll Mul(ll a, ll b) { return (a * b) % MOD; }
  static inline ll Div(ll a, ll b) { return (a % MOD) * modinv(b, MOD) % MOD; }
};
inline double distance(Pos p1, Pos p2) {
  return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}
inline int Kaijo(int n) {
  int ans = 1;
  for (int i = 2; i <= n; ++i) {
    ans *= i;
  }
  return ans;
}
template <typename T>
inline int keta(T num) {
  return to_string(num).length();
}
void Main();
inline void DebugMain() {
  while (true) {
    Main();
    cout << endl;
  }
}
int main() {
  bool debug = false;
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  if (debug) {
    cout << "\x1b[41m"
         << "Debug Mode このまま提出すると死" << endl;
  }
  try {
    (debug) ? DebugMain() : Main();
  } catch (exception& e) {
    cout << e.what() << endl;
  }
  return 0;
}
void recursive_comb(int* indexes, int s, int rest,
                    std::function<void(int*)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}
void foreach_comb(int n, std::function<void(int*)> f) {
  int indexes[3];
  recursive_comb(indexes, n - 1, 3, f);
}
inline bool isInHairetu(vector<string>& v, string& str) {
  if (v.size() == 0) {
    return false;
  }
  for (string& s : v) {
    if (s == str) {
      return true;
    }
  }
  return false;
}
string re(string& s) {
  string buf;
  for (int i = s.size() - 1; i >= 0; --i) {
    buf += s[i];
  }
  return buf;
}
template <typename T>
int find(vector<T>& v, T t) {
  for (int i = 0; i < v.size(); ++i) {
    if (v[i] == t) {
      return i;
    }
  }
  return -1;
}
inline void Main() {
  int n;
  cin >> n;
  vector<ll> a;
  for (int i = 0; i < n; ++i) {
    ll _a;
    cin >> _a;
    a.push_back(_a);
  }
  ll sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i; j < n; ++j) {
      sum = Mod::Add(sum, a[i] ^ a[j]);
    }
  }
  cout << sum;
}
