#include <bits/stdc++.h>
const int INF = 100100100;
const long long MOD = 1000000007;
using namespace std;
int main() {
  int N;
  int a[110000];
  long long res = 0;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  bool allzero = false;
  int digit = 1;
  while (!allzero) {
    bool isAllzero = true;
    int x = 0;
    int y = 0;
    for (int i = 0; i < N; i++) {
      if (a[i] % 2 == 1)
        x++;
      else
        y++;
    }
    res += (x * y * digit % MOD);
    digit = 2 * digit;
    for (int i = 0; i < N; i++) {
      a[i] = a[i] >> 1;
      if (a[i] > 0) isAllzero = false;
    }
    allzero = isAllzero;
  }
  cout << res << endl;
}
