#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long LINF = 1LL << 60;
const int INF = 1 << 30;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  for (long long i = 0; i <= 60; i++) {
    long long one = 0;
    long long zero = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] >> i & 1LL) {
        one += 1;
      } else {
        zero += 1;
      }
    }
    sum += ((one * zero) * long long(pow(2.0, float(i))));
    sum %= mod;
  }
  cout << sum % mod << endl;
  return 0;
}
