#include <bits/stdc++.h>
using namespace std;
bool next(vector<int> &a) {
  for (int &i : a) {
    if (i == 0) {
      i = 1;
      return true;
    }
    i = 0;
  }
  return false;
}
int count(vector<int> a) {
  int ans = 0;
  for (int aa : a) ans += aa == 1;
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(61, 0);
  vector<long long> b(61, 0);
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    int tmp = 0;
    while (x > 0) {
      if (x % 2 == 0) {
        a[tmp++]++;
      } else {
        b[tmp++]++;
      }
      x /= 2;
    }
    for (int j = tmp; j < 61; j++) {
      a[j]++;
    }
  }
  long long ans = 0;
  long long p = 1;
  for (int i = 0; i < 61; i++) {
    ans += a[i] * b[i] * p;
    p *= 2;
    ans %= 1000000007;
  }
  cout << ans;
  return 0;
}
