#include <bits/stdc++.h>
using namespace std;
const long long INF = 1ll << 50;
const long long mod = 1000000007;
long long n;
long long a[3 * 100000];
unordered_map<long long, long long> cnt;
unordered_map<long long, long long> xorcnt;
long long ans;
long long tmp;
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    for (long long b = 1; b < (1ll << 62); b <<= 1) {
      if ((a[i] & b) == 0) {
        xorcnt[b] += cnt[b];
      } else {
        xorcnt[b] += (i - cnt[b]);
        cnt[b]++;
      }
    }
  }
  for (auto x : xorcnt) {
    long long b = x.first % mod;
    ans += (b * x.second) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}
