#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, ans = 0;
  cin >> n;
  vector<vector<long long int> > a(n, vector<long long int>(100));
  long long int time = 0;
  for (long long int i = 0; i < (n); i++) {
    long long int x;
    long long int j = 0;
    cin >> x;
    while (x != 0) {
      a[i][j] = x % 2;
      j++;
      x /= 2;
    }
    time = max(time, j);
  }
  for (long long int i = 0; i < (time); i++) {
    long long int cnt = 0;
    for (long long int j = 0; j < (n); j++) {
      if (a[j][i] == 1) {
        cnt++;
      }
    }
    ans += (((cnt * (n - cnt)) % 1000000007) * ((long long int)1 << i)) %
           1000000007;
  }
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
