#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long dp[60][2];
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    cin >> a[i];
    a[i];
  }
  for (long long j = (long long)(0); j < (long long)(60); j++)
    for (long long i = (long long)(0); i < (long long)(2); i++) dp[j][i] = 0;
  for (long long i = (long long)(0); i < (long long)(n); i++)
    for (long long j = (long long)(0); j < (long long)(60); j++) {
      long long p = 1;
      for (long long k = (long long)(0); k < (long long)(j); k++) {
        p *= 2;
      }
      if (a[i] & p)
        dp[j][1]++;
      else
        dp[j][0]++;
    }
  long long ans = 0;
  for (long long j = (long long)(0); j < (long long)(60); j++) {
    long long p = 1;
    for (long long i = (long long)(0); i < (long long)(j); i++) {
      p *= 2;
    }
    ans = ans + ((dp[j][0]) * (dp[j][1])) * p % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
