#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long mod2 = 998244353;
const long long INF = 1e18;
const long double EPS = 1e-10;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long ans = 0, com = n * (n - 1) / 2, keta = 1;
  for (int k = 0; k < (60); ++k) {
    vector<long long> cnt(2, (long long)0);
    long long res = com;
    for (int i = 0; i < (n); ++i) {
      int x = a[i] % 2;
      cnt[x]++;
      a[i] >>= 1;
    }
    res -= cnt[0] * (cnt[0] - 1) / 2;
    res -= cnt[1] * (cnt[1] - 1) / 2;
    res %= mod;
    ans = (ans + keta * res) % mod;
    keta = (keta * 2) % mod;
  }
  cout << ans << endl;
  return 0;
}
