#include <bits/stdc++.h>
using namespace std;
long long powm(long long base, long long exp, long long mod = 1000000007) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % mod;
    exp >>= 1, base = (base * base) % mod;
  }
  return ans;
}
int32_t main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++)
    for (long long j = i + 1; j < n; j++) {
      ans += ((a[i] | a[j]) & (~a[i] | ~a[j]));
      ans = ans;
    }
  cout << ans % 1000000007 << endl;
}
