#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    int num0 = 0;
    int num1 = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] >> i & 1)
        num1++;
      else
        num0++;
    }
    int sum = num0 * num1;
    long long res = (1LL << i) * sum;
    ans += res;
    ans %= mod;
  }
  cout << ans << "\n";
}
