#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007, MAX = 200005, INF = 1 << 30;
long long rui(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return ans;
}
int main() {
  std::ifstream in("text.txt");
  std::cin.rdbuf(in.rdbuf());
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> cnt(62, 0);
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1LL << j)) cnt[j]++;
    }
  }
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1LL << j)) {
        sum += (1LL << j) * (N - cnt[j]);
      } else {
        sum += (1LL << j) * cnt[j];
      }
      sum %= mod;
    }
  }
  cout << sum * rui(2, mod - 2) % mod << endl;
}
