#include <bits/stdc++.h>
const int N = (int)1e5 + 7;
const int MOD = (int)1e9 + 7;
const long long INF = (long long)1e18;
using namespace std;
int main() {
  int n;
  long long x;
  cin >> n;
  vector<vector<int>> A(2, vector<int>(61));
  while (n--) {
    cin >> x;
    for (int i = 0; i < 61; i++) {
      A[(x & (1ll << i)) > 0][i]++;
      A[(x & (1ll << i)) > 0][i] %= MOD;
    }
  }
  long long res = 0;
  for (int i = 0; i < 61; i++) {
    res += ((((long long)A[0][i] * A[1][i]) % MOD) * (1ll << i) % MOD) % MOD;
    res %= MOD;
  }
  cout << res;
  return 0;
}
