#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
void solve() {
  int N;
  cin >> N;
  vector<string> A(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    bitset<60> b = a;
    string c = b.to_string();
    A[i] = c;
  }
  const int mod = 1000000007;
  vector<int> vec(60);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < A[i].length(); j++) {
      if (A[i][j] == '1') {
        vec[j]++;
      }
    }
  }
  long long ans = 0;
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) {
    long long value = vec[i];
    long long tmp = (pow(2, i) * value * (N - value));
    ans += tmp;
    if (i > 10) break;
  }
  cout << ans % mod << endl;
}
signed main() { solve(); }
