#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[300000][60];
  int arr2[300000][60];
  int MOD = 1000000007;
  int arr3[60];
  long long cnt;
  cnt = 0;
  for (int i = 0; i < 60; i++) arr3[i] = 0;
  arr3[0] = 1;
  for (int i = 1; i < 60; i++) {
    arr3[i] = (arr3[i - 1] * 2) % MOD;
  }
  for (int i = 0; i < 300000; i++)
    for (int j = 0; j < 60; j++) {
      arr[i][j] = 0;
      arr2[i][j] = 0;
    }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long cur;
    cin >> cur;
    for (int j = 0; j < 60 && cur != 0; j++) {
      arr[i][j] = cur % 2;
      cur = cur / 2;
    }
  }
  for (int i = 0; i < 60; i++) {
    arr2[n - 1][i] = arr[n - 1][i];
  }
  for (int i = n - 2; i >= 0; i--)
    for (int j = 0; j < 60; j++) {
      arr2[i][j] = arr2[i + 1][j] + arr[i][j];
    }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 60; j++) {
      if (arr[i][j])
        cnt += (arr3[j] * (n - i - 1 - arr2[i + 1][j])) % MOD;
      else
        cnt += (arr3[j] * arr2[i + 1][j]) % MOD;
      cnt = cnt % MOD;
    }
  }
  cout << cnt << endl;
  return 0;
}
