#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int64_t> x(64, 0);
  vector<int64_t> nx(64, 0);
  vector<int64_t> vv(n);
  for (int i = 0; i < n; i++) {
    int64_t a;
    cin >> a;
    vv[i] = a;
    stringstream ss;
    ss << bitset<64>(a);
    string s = ss.str();
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == '1')
        x[j]++;
      else
        nx[j]++;
    }
  }
  int64_t ans = 0;
  int64_t mod = 1000000007;
  for (int j = 0; j < n; j++) {
    stringstream ss;
    ss << bitset<64>(vv[j]);
    string s = ss.str();
    for (int i = 0; i < 64; i++) {
      int64_t tmp = 1;
      if (s[i] == '1') {
        x[i]--;
        tmp *= nx[i];
      } else {
        nx[i]--;
        tmp *= x[i];
      }
      tmp %= mod;
      tmp *= pow(2, 63 - i);
      tmp %= mod;
      ans += tmp;
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
