#include <bits/stdc++.h>
using namespace std;
class XOR {
 public:
  void solve(std::istream& in, std::ostream& out) {
    unsigned long long int n, i, j, s = 0, m = 1000000007;
    in >> n;
    unsigned long long int a[n];
    for (i = 0; i < n; i++) in >> a[i];
    for (i = 0; i < n - 1; i++) {
      for (j = i + 1; j < n; j++) {
        s += (a[i] ^ a[j]) % m;
      }
    }
    out << s % m << endl;
  }
};
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  XOR solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
