#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T>
inline string to_bin_str(T n) {
  string str;
  while (n > 0) {
    str.push_back('0' + (n & 1));
    n >>= 1;
  }
  reverse(str.begin(), str.end());
  return str;
}
int bd(int a) {
  int weight = 1;
  int total = 0;
  while (a != 0) {
    total += (a % 10) * weight;
    a /= 10;
    weight *= 2;
  }
  return total;
}
int main() {
  int N, A;
  cin >> N;
  ll ans = 0;
  vector<int> a(N);
  string S;
  for (int i = 0; i < (int)(N); i++) {
    cin >> A;
    S = to_bin_str(A);
    a[i] = atoi(S.c_str());
    if (i >= 1) ans += bd(a[0] ^ a[i]);
  }
  for (int j = 1; j < N - 1; j++) {
    for (int k = j + 1; k < N; k++) {
      ans += bd(a[j] ^ a[k]);
    }
  }
  cout << ans % 1000000007;
  return 0;
}
