#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
const int MOD = 1e9 + 7;
int cnt1[66], cnt0[66];
int pw(int n) {
  int res = 1;
  while (n--) {
    res += res;
    res %= MOD;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int ans = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    string s = "";
    for (long long j = 0; j < 60; j++) {
      if (a & (1ll << j))
        s += '1';
      else {
        s += '0';
      }
    }
    if (i != 0) {
      for (int j = 0; j < s.size(); j++) {
        if (s[j] == '0') {
          ans += ((long long)cnt1[j] * (long long)pw(j)) % MOD;
          ans %= MOD;
          cnt0[j]++;
        } else {
          ans += ((long long)(cnt0[j]) * (long long)pw(j)) % MOD;
          ans %= MOD;
          cnt1[j]++;
        }
      }
    } else {
      for (int j = 0; j < s.size(); j++) {
        if (s[j] == '1')
          cnt1[j]++;
        else {
          cnt0[j]++;
        }
      }
    }
  }
  cout << (int)(ans % MOD);
}
