#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
const long long int mod = 1e9 + 7;
long long int n, a[maxn];
long long int ans = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) {
    for (int l = i + 1; l <= n; l++) {
      ans += (a[i] | a[l]) - (a[i] & a[l]);
      if (ans >= mod) ans %= mod;
    }
  }
  printf("%lld", ans);
  return 0;
}
