#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int sum_1[65];
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < 65; j++) {
      sum_1[j] += a & 1;
      a >>= 1;
    }
  }
  long long fact_2 = 1;
  for (int i = 0; i < 65; i++) {
    sum += fact_2 * sum_1[i] * (n - sum_1[i]);
    sum %= mod;
    fact_2 *= 2;
    fact_2 %= mod;
  }
  cout << sum << endl;
}
