#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long LINF = 1000000000000000000;
const double PI = acos(-1.0);
const double EPS = 1e-10;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int(i) = 0; (i) < (N); (i)++) {
    cin >> A[i];
  }
  long long zero, one, digit;
  long long sum = 0;
  digit = 1;
  bool flag = true;
  while (flag) {
    flag = false;
    zero = one = 0;
    for (int(i) = 0; (i) < (N); (i)++) {
      if (A[i] != 0) flag = true;
      if (A[i] & 1)
        ++one;
      else
        ++zero;
      A[i] = (A[i] >> 1);
    }
    sum += one * zero * digit;
    sum %= 1000000007;
    digit = (digit << 1);
  }
  cout << sum << "\n";
  return 0;
}
