#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main() {
  ll n;
  cin >> n;
  ll a[n + 10];
  ll s = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (ll i = 0; i < n; i++) {
    for (ll j = i + 1; j < n; j++) {
      s += ((a[i] | a[j]) & (~a[i] | ~a[j])) % 1000000007;
    }
  }
  cout << s % 1000000007 << '\n';
  s = 0;
}
