#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long all = 0, mod = 1000000007;
  bitset<60> cnt;
  vector<int> a(n);
  vector<bitset<61>> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    b.at(i) = bitset<61>(a.at(i));
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      all += (b.at(i) ^ b.at(j)).to_ullong();
    }
  }
  cout << all % mod << endl;
}
