#include <bits/stdc++.h>
using namespace std;
using pi = pair<long, long>;
const long mod = 1e9 + 7;
signed main() {
  long n;
  cin >> n;
  vector<long> a(n);
  for (auto& i : a) cin >> i;
  long suma = 0, land = 0;
  for (auto i : a) suma = (suma + i) % mod;
  long res = 0;
  for (auto i : a)
    for (auto j : a) land = (land + (i & j)) % mod;
  res = (n * suma - land) % mod;
  cout << res;
}
