#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long* a = new long long[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      int ans = ((a[i] | a[j]) & (~a[i] | ~a[j])) % 1000000007;
      sum = sum + ans;
    }
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
