#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, i, j, zero = 0, one = 0, power = 1, a, sum = 0;
  cin >> n;
  vector<vector<long long int> > v1;
  for (i = 0; i < n; i++) {
    cin >> a;
    vector<long long int> v(60, 0);
    j = 0;
    while (a != 0) {
      v[j] = a % 2;
      j++;
      a /= 2;
    }
    v1.push_back(v);
  }
  for (i = 0; i < 60; i++) {
    zero = 0, one = 0;
    for (j = 0; j < v1.size(); j++) {
      if (v1[j][i] == 0)
        zero++;
      else
        one++;
    }
    sum =
        (sum % 1000000007 + (zero * one * (power % 1000000007)) % 1000000007) %
        1000000007;
    power *= 2;
  }
  cout << sum << endl;
  return 0;
}
