#include <bits/stdc++.h>
using namespace std;
using llint = long long int;
constexpr long long int linf = numeric_limits<long long int>::max() - 5;
constexpr long long int inf = numeric_limits<int>::max() - 5;
constexpr long long int mod = 1000000007;
int main() {
  llint n;
  cin >> n;
  vector<llint> v(n);
  for (long long int i = 0; (i) < (n); i++) {
    cin >> v[i];
  }
  llint h, l, result = 0;
  for (llint i = 1; i < (1ll << 62ll); (i <<= 1)) {
    h = 0;
    l = 0;
    for (long long int j = 0; (j) < (n); j++) {
      if (i & v[j]) {
        h++;
      } else {
        l++;
      }
    }
    result += ((i % mod) * (h % mod) * (l % mod)) % mod;
    result %= mod;
  }
  result += mod;
  result %= mod;
  cout << result << endl;
  return 0;
}
