#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> v(n);
  vector<long long> data(61);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
    long long k = v[i];
    long long cnt = 0;
    while (k != 0) {
      data[cnt++] += k % 2;
      k /= 2;
    }
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    vector<bool> visited(61);
    long long k = v[i];
    long long cnt = 0;
    while (k != 0) {
      visited[cnt++] = k % 2;
      k /= 2;
    }
    for (long long j = 0; j < 61; j++) {
      if (visited[j]) {
        sum += pow(2, j) * (n - i - data[j]);
      } else {
        sum += pow(2, j) * data[j];
      }
      sum %= mod;
      if (visited[j]) data[j]--;
    }
  }
  sum %= mod;
  cout << sum << endl;
  return 0;
}
