#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double PI = acos(-1);
const long double EPS = 0.0000000001;
vector<long long> fac, finv, inv;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> a.at(i);
  sort(a.begin(), a.end());
  long long res = 0;
  for (long long i = 0; i < (long long)(61); i++) {
    long long cnt0 = 0, cnt1 = 0;
    for (long long j = 0; j < (long long)(n); j++) {
      if (a[j] & 1LL << i)
        cnt1 += 1;
      else
        cnt0 += 1;
    }
    long long tmp = (1LL << i) % MOD;
    res += tmp * cnt1 * cnt0;
    res %= MOD;
  }
  cout << res << endl;
}
