#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int n, a[62], b[62];
int ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (int j = 61; j >= 0; j--)
      if (!((1ll << j) & x))
        b[j]++, ans = (ans + (1ll * a[j] * (1ll << j) % mod) % mod) % mod;
      else
        a[j]++, ans = (ans + (1ll * b[j] * (1ll << j) % mod) % mod) % mod;
  }
  cout << ans;
  return 0;
}
