#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int a[61][2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    for (long long j = 0; j < 61; ++j) {
      if (x & (1LL << j)) {
        a[j][1]++;
      } else {
        a[j][0]++;
      }
    }
  }
  long long sol = 0;
  for (long long j = 0; j < 61; ++j) {
    sol +=
        (((a[j][0] % MOD) * (a[j][1] % MOD)) % MOD * ((1LL << j) % MOD)) % MOD;
    sol = sol % MOD;
  }
  cout << sol;
  return 0;
}
